Question: Question 2 In this question, you need to implement four classes: Item, TaxableItem, Buyer, and TaxCalculator. The design of the Item, TaxableItem, and Buyer classes

 Question 2 In this question, you need to implement four classes:

Item, TaxableItem, Buyer, and TaxCalculator. The design of the Item, TaxableItem, and

Question 2 In this question, you need to implement four classes: Item, TaxableItem, Buyer, and TaxCalculator. The design of the Item, TaxableItem, and Buyer classes is shown in the class diagram below. Item - name: String - price: double Buyer - name: String +toString(): String Extends Taxableltem taxRate: double Ensure the application of the design principles that you learned in the class. Make your program as robust as possible. For example, throw exceptions if an argument is illegal e.g., the price must be non-negative. All instances variables must be declared private. Provide the necessary public setter/getter methods. Item and buyer names must be declared final. You should define the necessary constructors to assign initial values to the instance variables. These are not included in the class diagram. super should be used where necessary. Override the methods in the superclass when necessary. Use toString() in each class to print the relevant object's information. For the TaxCalculator class: Include the main() method. Create two Buyers in the main method: O Name of the first buyer: Ahmed Name of the second buyer: Ali o Three taxable items should be created in the main method: oil with the following values: Name: Samsung S10 Price: 840 Tax rate: .05 Buyer: Ahmed O i2 with the following values: Name: iPhone 7 Price: 1100 Tax rate: .07 Buyer: Ahmed 13 with the following values: Name: Huawei M5 Price: 600 Tax rate: .10 Buyer: Ali Main method should print the list of items. The output of the program should be the same as the following sample: Samsung S10, 840.00 AED, Buyer: Ahmed, Tax rate: 0.05 iPhone, 1100.00 AED, Buyer: Ahmed, Tax rate: 0.07 Huawei, 600.00 AED, Buyer: Ali, Tax rate: 0.10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!