#1313 Add Separated Interface design pattern

This commit is contained in:
swarajsaaj
2020-09-10 02:57:56 +05:30
parent ef326ee77e
commit f6942cf18d
13 changed files with 527 additions and 0 deletions

View File

@ -0,0 +1,36 @@
@startuml
package com.iluwatar.separatedinterface {
class App {
- LOGGER : Logger {static}
+ PRODUCT_COST : double {static}
+ App()
+ main(args : String[]) {static}
}
}
package com.iluwatar.separatedinterface.taxes {
class DomesticTax {
+ TAX_PERCENTAGE : double {static}
+ DomesticTax()
+ calculate(amount : double) : double
}
class ForeignTax {
+ TAX_PERCENTAGE : double {static}
+ ForeignTax()
+ calculate(amount : double) : double
}
}
package com.iluwatar.separatedinterface.invoice {
class InvoiceGenerator {
- amount : double
- taxCalculator : TaxCalculator
+ InvoiceGenerator(amount : double, taxCalculator : TaxCalculator)
+ getAmountWithTax() : double
}
interface TaxCalculator {
+ calculate(double) : double {abstract}
}
}
InvoiceGenerator --> "-taxCalculator" TaxCalculator
DomesticTax ..|> TaxCalculator
ForeignTax ..|> TaxCalculator
@enduml