Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3 . 1 2 LAB: Product class ( EO ) Given main ( ) , define the Product class that will manage product inventory. Product
LAB: Product class EO
Given main define the Product class that will manage product inventory. Product class has three private member fields: a product code String the product's price double and the number count of product in inventory int
Implement the following Constructor and member methods as listed below:
public ProductString code, double price, int count set the member fields using the three parameters
public void setCodeString code set the product code ie SKU to parameter code
public String getCode return the product code
public void setPricedouble p set the price to parameter p
public double getPrice return the price
public void setCountint num set the number of items in inventory to parameter num
public int getCount return the count
public void addInventoryint amt increase inventory by parameter amt
public void sellInventoryint amt decrease inventory by parameter amt
Ex If a new Product object is created with code set to "Apple", price set to and the count set to the output is:
Name: Apple
Price:
Count:
Ex If apples are added to the Product object's inventory, but then are sold, the output is:
Name: Apple
Price:
Count:
Ex If the Product object's code is set to "Golden Delicious", price is set to and count is set to the output is:
Name: Golden Delicious
Price:
Count:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started