Question: This is a Java Problrm Starting Out With Java Early Objects Chapter 11 Program Challenge 3. RetailItem Exceptions Programming Challenge 4 of Chapter 3, listed

This is a Java Problrm

Starting Out With Java Early Objects Chapter 11 Program Challenge

3. RetailItem Exceptions

Programming Challenge 4 of Chapter 3, listed below, required you to write a RetailItem class that held data pertaining to a retail item. Write an exception class that can be instantiated and thrown when a negative number is given for the price. Write another exception class that can be instantiated and thrown when a negative number is given for the units on hand. Demonstrate the exception classes in a program.

This is Challenge 4 of Chapter 3

 This is a Java Problrm Starting Out With Java Early Objects

5. Retailitem Class Write a class named Retailltem that holds data about an item in a retail store. The class should have the following fields description. The description field is a String object that holds a brief description of the item. . unitsOnHand. The unitsOnHand field is an int variable that holds the number of units currently in inventory. price. The price field is a double that holds the item's retail price Write appropriate mutator methods that store values in these fields and accessor methods that return the values in these fields. Once you have written the class, write a separate pro- gram that creates three RetailItem objects and stores the following data in them. Description Item #1 Item #2 Item #3 Units On Hand Jacket Designer Jeans Shirt 12 40 20 Price 59.95 34.95 24.95

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!