Java Class product which has attributes: String name, type integer number_on_hand,

  • Define a Java Class product which has attributes: String name, type integer number_on_hand, and double price Write all the getters and setters for each of these values. Write a default constructor which has no values and a constructor which takes all values as parameters and initialized the attribute to the values passed

  • Define a class PerishableProduct which extends product and has additional attributes integer day month and year, which represent a use by date. Write the necessary getters and setters and write a pair of constructors like in 1.

  • Write a piece of java code that prompts the user the name, type, price, quantity and use by date of a perishable product and creates an object with those values.

  • Write a piece of java code that prompts the users for a text file name creates a scanner for the file and then reads Perishable product from the file into an array called inventory.

  • Write a piece of java code that prompts the user for the name of a perishable product and searches the array inventory to find the product and prints out the price.

  • Write a piece of java code that prompts the user for a file name and opens a text file for output and writes the array inventory to the file and closes the file.



  • Powered by