During my preparation for an exam in software engineering, I came across the following task in an old exam:
For a client, you create a new financial software whose task is, among other things, to perform tax calculations. The following requirements have been communicated to you by the Client:
- The system must be able to:
- calculate and display VAT for different countries and tax rates (Germany 19%, Austria 20%, Switzerland 8%).
- calculate and display the income tax according to country-specific tax tables (separate table for Germany, Austria, Switzerland).
- The system must allow the user to:
- enter the tax relevant data (gross amount for VAT, annual income for income tax)
- print the result of the tax calculation on a network printer.
- send the result of the tax calculation to the appropriate tax office.
Task 1: Capture the requirements communicated by the client in a domain model (class diagram) with the following information: classes, attributes, methods, relationships, multiplicities, relationship name.
Solution: after a long discussion In a question asked yesterday (Designing a domain model (class diagram) for a financial software), the following class-diagram was created by Christophe, which is a convincing solution:**
So I just want to know if the solutions of the following tasks are correct:
-
the system with red borders is the authority system, which includes the state and the tax office.
-
the blue-bordered system: tax service system: I have called it that, because of the different services offered here
-
the green-bordered system: tax System
-
As a developer, you use the Strategy Pattern to calculate the tax, to improve the design Apply the Strategy Pattern to the problem.
-
a) What are the basic advantages of using Design Patterns?
Solution:
- Design Patterns explicitly capture expert knowledge and design tradeoffs and make this expertise widely available --> They offer the possibility to solve problems in software development with a proven solution.
- Design patterns increase the efficiency of communication between designers
b) Which class of your design holds the context, which holds the strategy?
Solution:
- The class "TaxCalculation" holds the context
- The class "Tax" holds the strategy
c) Model this part in a class diagram using the pattern.
Solution: i'm not quite sure, but i think that in the class diagram above the strategy pattern is already modeled for the most part. In order to fulfill all requirements for a strategy pattern, the class "Tax" has to become an interface, which means that the subclasses "VAT" and "IncomeTax" have to implement all methods of "Tax", so "getTaxCode()" has to be implemented in both classes and "code" has to be constant.
d) What are the benefits for the tax calculation?
Solution: the advantages of using the strategy pattern for tax calculation are that it allows you to dynamically add new tax rules or modify existing ones. For example, a new class "VAT2", which is similar to "VAT", can also implement the "Tax" interface.
-
my question is: Are the solutions, especially for task 3, correct?
Could someone help me with this? Thanks :)
Aucun commentaire:
Enregistrer un commentaire