Question: java 2 code . . Suppose: There is a store that sells: Goods, each of which has the following attributes: a description a price (per
java 2 code

. . Suppose: There is a store that sells: Goods, each of which has the following attributes: a description a price (per item) a quantity (items on hand) And one method a toStringo The types of goods are: with an attribute "calories". Food objects are not taxable Toy - with an attribute "minimumAge". Toy objects are taxable. o Book with an attribute "author". Book objects are taxable. o Food - - . A Taxable item Has a taxRate of 6 percent (0.06). Has a calculate Tax O method. Define a project with name Interface Concept to define these classes and the interface according to the following this UML. > Goods > -description: String Taxable -price: double tax Rate 30.06 -quantity: int +getters calculate Tex (): double +Setters toString(): String get TotalPrice (): double is-a 1S-a is-a Food calories double constructor +ToString 0: String *setter *getter *get TotalPrice ()double Book author: String *constructor toString: String *calculate Tax (): double setter *geffer get TotalPrice (): double - minimumAge: int constructor +toString: String *calculate Tax (): double setter *getter get TotalPrice ( double calculate Tax() implements as follow: price*tax get TotalPrice() implements as follow: in Food class quantity* price; in Book class quantity* (price + price*tax) in Toy class quantity* (price + price*tax) toString() This method returns information of the all attributes as String data type . In main method: Create an object of three types Book Food Print the information of these objects. * Print description of toy object, tax value and total price. Change description of book object from OOP to Data Structures. * Print new information after changing. Print description of book object, tax value and total price. Print description of food object and total price
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
