You are on page 1of 1

www.oracle.

com/academy

Java Fundamentals
Section 7 Part 2: Creating an Inventory Project
Project

Overview
This project will progress with you throughout the course. After each section there will be more to add until it 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 javaInventory.

Create an inventory program that can be used for a range of different products (cds, dvds, software, etc.).

Requirements - (Solutions: ProductPart5, ProductTesterPart5)

At this point, students should create new classes ProductPart5 and ProductTesterPart5 that will add onto the
functionality of the project. (copy and paste part 4 code into new part 5 classes)

Topic(s): Adding a subclass, using extends, using super(), overriding methods from a superclass.

1. Create a subclass of the ProductPart5 class that has two additional variables. (For example, a DVD
subclass could use movie title and length).

2. 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 subclass method should also add a 5% restocking fee to
the value of the inventory of that product.

3. Override the toString() method from the ProductPart5 class so that all information about new subclass objects
can be printed to the output.

4. Modify ProductTesterPart5 so that an array of objects of the new subclass can be created from user input.
Display the subclass products using a for loop.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.

You might also like