CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades | Students

Midterm Test

Create inventory of products

Due Date: Thursday of Week
50 points

Console

This test uses a class that defines inventory of products and a subclass that defines DVD.

Operation

  • This application retrieves the inventory of products and DVDs and display their informations.

Specifications

  • Create an Inventory class that holds the item number, the name of the product, the number of units in stock, and the price of each unit.

  • Create the constructor for the Inventory that has 4 parameters. Create the get and set methods. Use the set methods in the constructor.

  • Create the getInventoryValue method to return the total value of the stock for a product (the number of units in stock multiplied by the price of each unit).

  • Create a method to display the product number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory. Use the get methods.

  • Create a DVD subclass of the Inventory class that has two additional features: restocking fee (5%) and rating. The user does not supply the restocking fee.

  • Create the constructor for DVD subclass with 5 parameters (additional rating). Create the get and set methods. This is a subclass so you know what to do and use the set method for rating.

  • For the DVD subclass, create getInventoryValue method (polymorphism). This method should also add a 5% restocking fee to the value of the inventory of the DVD.

  • For the DVD subclass, create the same method (defined in the Inventory class) to display the item number, the title of the product, the rating, the number of units in stock, the price of each unit, the restocking fee, and the value of the inventory. Use the get methods.

  • Create an InventoryApp class to make at least 2 instances of the Inventory class, and display them. Then make at least 3 instances of the DVD class and display them. Hard code the data by passing the arguments. There is no need to ask for ser input.
Include in your program the following comments:
  • Name of program
  • Programmer's name
  • Current Date
  • Computer system and compiler you are using
  • Brief description of the program

Compile and run the Java program.

When you are ready, upload the java program by clicking the link below:

Upload Assignment

I cannot grade if I don't get the files and receive your email.