230k views
4 votes
Write a class named RetailItem that holds data about an item in a retail store. The class should have the following properties:

• Description —The Description property should hold a brief description of the item.
• UnitsOnHand —The UnitsOnHand property should hold the number of units currently in inventory.
• Price —The Price property should hold the item's retail price.

1 Answer

3 votes

Final answer:

A class named RetailItem can be defined with properties: description, unitsOnHand, and price.

Step-by-step explanation:

A class named RetailItem can be defined in the following way:

class RetailItem {
String description;
int unitsOnHand;
double price;
}

This class has three properties: description, unitsOnHand, and price. The description property is of type String and holds a brief description of the item. The unitsOnHand property is of type int and holds the number of units currently in inventory. The price property is of type double and holds the item's retail price.

User Zain Aftab
by
8.6k points