Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are given the abstract class Clothing in Clothing. java. This class contains

ID: 441634 • Letter: Y

Question

You are given the abstract class Clothing in Clothing. java. This class contains the basic informationthat all articles of clothing need and an abstract method called total (). Design and implement the following 4 classes: Children, Adult, BCAdult and ONAdult. Specifically, Children and Adult inherit from Clothing. Children's clothing are not tax applicable, so its total price is the same as the sale price. Adult clothinghas a national tax applied to them, OST, which is 5% and should be representedas a constant. Therefore, Adu1t needs an additional method called appl yGST() to calculate this tax. For example, if the sale price is $2.00, then applyGST () calculates $2.00 5% = $0.10. This method is only called by total () within the class. BC Adult and ONAdult inherit fromAdult. Adult clothing requires an additionalprovincial tax, PST. BC has a 7% PST, so BC Adult represents this value as a constant. Ontario has a 8% PST, so ON Adult represents this value as a constant. bothh BCAdult and ONAdult will need an additional method called applyPST () that calculates the applicable provincial tax. This method is only called by total () within the class. Note that the total price is now the sale price plus OST and PST. 'Write a class called Purchases that contains the main method. Inside main, you will instantiateone object for each of Children, BCAdult, and ONAdult. Using a polymorphic solution, print out each object's information (using toString () and total price (using total (». A polymorphic solution is required to obtain full marks for this question. An example output of yourprogramshould looklike the following: This children item is a ShirtJ size 5, name brand Disney. Before taxes it is 6.99. After taxes, the cost is 6.99.This adult item sold in British Columbia is a Shirt, size L, name brand Old Navy. Before taxes it is 14.99. After taxes, the cost is 16.79. This adult item sold in Ontario is a Shirt, size M, name brand Nike. Before taxes it is 18.99. After taxes, the cost is 21.46.

Explanation / Answer

Clothing Abstract Class



public abstract class Clothing {


private String itemName;

private String size;

private double price;

private String itemBrand;

public Clothing() {

super();

}

public Clothing(String itemName, String size,double price, String itemBrand) {

super();

this.itemName = itemName;

this.size = size;

this.price=price;

this.itemBrand = itemBrand;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

public String getItemName() {

return itemName;

}

public void setItemName(String itemName) {

this.itemName = itemName;

}

public String getSize() {

return size;

}

public void setSize(String size) {

this.size = size;

}

public String getItemBrand() {

return itemBrand;

}

public void setItemBrand(String itemBrand) {

this.itemBrand = itemBrand;

}

public abstract double total();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote