Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

3 What are the aims of appraisal?

Answered: 1 week ago