Question: RetailItem.java - Write a class named RetailItem that reads data from an input file about an item in a retail store. - The class should

RetailItem.java

- Write a class named RetailItem that reads data from an input file about an item in a retail store. - The class should have the following fields: description (String), unitsOnHand (int), price (double). - Write a constructor that accepts arguments for each field - Write mutators & accessors that return thte values in these fields. - Add a static constant attribute called DISCOUNT and set it to 20% or (0.20) to the RetailItem class. - Include a applyDiscount() method - Computes the new price of an item using the constant as above - Include a toString() to the RetailItem class - Displays the description, unitsOnHand, and Price.

RetailItemDriver.java

- Declare 3 retail items as follows: (Item#1: Jacket, 12 on hand, price $59.95), (Item#2: Jeans, 40 on hand, price $34.95), (Item#3: Shirt, 20 on hand, price $24.95). - Create a method to read data for the 3 objects and create the objects (from a data file), create objects one at a time and return the object reference. - Write a method named display() - displays one object at a time & displays the current state of the object. Include the display of the new price of the item after the discount is applied using method applyDiscount() for this. - Write a method named displayAll() - displays all RetailItem objects, one at a time.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!