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

Overview This project will progress with you throughout the course. After each s

ID: 3904750 • Letter: O

Question

Overview This project will progress with you throughout the course. After each section there will be more to ad undi t builds into a complete Java application to maintain Inventory. For each part, build upon the last part so that both the old and new requirements are met. Include all parts in a package called javalnventory Create an inventory program that can be used for a range of different products (ods, dvds, software, etc.) Requirements- (Solutions: ProductPart5, ProductTesterPart5) At this point, students should create new classes ProductParts and ProductTesterParts that wil add onto the functionality of the project. (oopy and paste part 4 code into new part 5 classes) Topice) Adding a subclass, using extends, using supero. overring methods from a superciases 1. Create a subclass of the ProductParts class that has two additional variables, (For example, a DVD subclass could use movie tite and length) In the subclass, override the method to calculate the value of the inventory of a product with the same name as that method previously created for the product class. The subdass method should also add a 5% restocking fee to the value of the inventory of that product 2. uctParts class so that all information about new subclass 3. Override the tosting) method from the ProductParts class s0 can be printed to the output 4 Modify ProduatTesterPart5 so that an array of objects of the new subclass can be created from user Display the subclass products using a for loop

Explanation / Answer

class DVD extends ProductPart5{

    private String title;
    private double length;

    public DVD(){
       super();
       title = "";
       length = 0;
    }

    public DVD(...,String t, double l){ //... denotes the list of parameters of ProductPart5(super class)

        super(...);
        title = t;
        length = l;
    }
    public double getLength(){
        return length;
    }
    public String getTitle(){
        return title;
    }
    public setTitle(String a){
       title = a;
    }
    public setLength(double a){
       length = a;
    }
    String toString(){
        return super.toString() + " Title:" + title + " Length" + Double.toString();
    }
    double valueOfTheInventory(){

        return super.valueOfTheInventory() + 0.05 * super.valueOfTheInventory();
    }

}

Relevant code for getting user input and the for loop is as follows:

DVD[] list = new DVD[100];
Scanner sc - new Scanner(System.in);
System.out.println("Enter number of DVDs:");
int n = Integer.parseInt(sc.nextLine());
for (int i = 0; i<n; i++){
    System.out.println("Enter title");
    title = sc.nextLine();
    System.out.println("Enter title");
    length = Double.parseDouble(sc.nextLine());
    list[i] = new DVD(title,length) //// Other inputs will be as per ProductPart5
}

for (int i = 0; i<n; i++){
System.out.println(list[i]);
}


for (