Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1a. Create a class named Inventory - Separate declaration from implementation (i.e. Header and CPP files) 1b. Add the following private member variables - a

1a. Create a class named Inventory - Separate declaration from implementation (i.e. Header and CPP files) 1b. Add the following private member variables - a int variable named itemNumber - an int variable named quantity - a double variable named cost - a double variable named totalCost. Total cost is defined as quantity X cost. - updateTotalCost() which takes no arguments and sets the values of the variable totalCost. 1c. Add the following public functions: - Accessor and Mutators for all private member variables - getTotalCost which returns the value of totalCost - Default constructor which sets all the member variables to 0. Finally, call the updateTotalCost function. - A non-default constructor which accepts an items number, quantity, and cost as arguments. This constructor must calls the mutator functions to set the values of the appropriate member variables. Finally, call the updateTotalCost function. 1d. Write a main(): - Create an instance of type Inventory using the default constructor. - Prompt the user to enter an itemNumber, cost, and quantity. - Use the mutator methods to update itemNumber, cost, and quantity. - Using the accessor functions, print the values of itemNumber, cost, quantity, and totalCost. - Create a new instance of type Inventory using the non-default constructor. - Using the accessor functions, print the values of itemNumber, cost, quantity, and totalCost.

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

More Books

Students also viewed these Databases questions