isplay the associated data for stockltem2. 3. Use the setter functions (mutators) to change the stockltem2 to 243, 50, 9.50. 4. Check the input validation by setting the itemNumber, quantity and cost to -1 using the setter functions. Observe the output.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I have the code for question 1 and 2 complete. Just need the code for question 3 and 4. C++ programming language please.

P
00
< co
Implement all the methods specified above to complete the Inventory class.
In the tester program, Inventory.cpp, include the following operations.
1. Create an instance of Inventory class, stockltem1 using the default constructor. Display
the itemNumber, quantity, cost and totalCost of stockltem1
2. Create another instance of Inventory class, stockltem2 using the overloaded
constructor, and passing the following for itemNumber, quantity and cost - 124, 12,
84.95. Display the associated data for stockltem2.
3. Use the setter functions (mutators) to change the stockltem2 to 243, 50, 9.50.
4. Check the input validation by setting the itemNumber, quantity and cost to -1 using the
setter functions. Observe the output.
Submit both Inventory.h and Inventory.cpp files. Include sample output for all test cases.
Sample Output
/* RUN OUTPUT PRODUCED BY THIS TEST PROGRAM
Demonstrating the default constructor...
Item number: 0
Quantity : 0
Cost
00 0 -
MacBook Pro
000
000
#3
$
*
R
Transcribed Image Text:P 00 < co Implement all the methods specified above to complete the Inventory class. In the tester program, Inventory.cpp, include the following operations. 1. Create an instance of Inventory class, stockltem1 using the default constructor. Display the itemNumber, quantity, cost and totalCost of stockltem1 2. Create another instance of Inventory class, stockltem2 using the overloaded constructor, and passing the following for itemNumber, quantity and cost - 124, 12, 84.95. Display the associated data for stockltem2. 3. Use the setter functions (mutators) to change the stockltem2 to 243, 50, 9.50. 4. Check the input validation by setting the itemNumber, quantity and cost to -1 using the setter functions. Observe the output. Submit both Inventory.h and Inventory.cpp files. Include sample output for all test cases. Sample Output /* RUN OUTPUT PRODUCED BY THIS TEST PROGRAM Demonstrating the default constructor... Item number: 0 Quantity : 0 Cost 00 0 - MacBook Pro 000 000 #3 $ * R
* 00
RR
3.
Class
Request edit ace
Design an inventory class (Inventory.h) that holds the information for an item in a retail store's
inventory. Implement the class based on the UML diagram shown below:
Inventory
private:
int itemNumber;
int quantity;
double cost;
I/An int that holds the item's number
I/An int that holds the quantity of the item on hand
IIA double that holds the wholesale per-unit cost of the
item
public:
Inventory()
Inventory(int, int, double); 1/Overloaded constructor.
//Default constructor. Sets all the member variables to 0.
I/Accepts an item's number, quantity, and cost as arguments.
void setltemNumber(int); /I/Accepts an int argument and copies it into the
itemNumber member variable.
void setQuantity(int); //Accepts an int argument and copies it into the quantity
member
void setCost(double); IIAccepts a double argument and copies it into the cost
member variable
int getltemNumber(); I/ Returns the value in itemNumber
int getQuantity(); //Returns the value in quantity
double getCost(); //Returns the value in cost
double getTotalCost(); //Computes and returns the total cost
bool validInt(int); I/This function returns true if its integer argument is valid (i.e.
non-negative), and returns false otherwise.
bool validFloat(double); //This function returns true if its floating-point
argument is valid (i.e. non-negative), and returns false otherwise.
Implement all the methods specified above to complete the Inventory class.
In the tester program, Inventory.cpp, include the following operations.
MacBook Pro
000
000
&
$
%
)
9
8.
Transcribed Image Text:* 00 RR 3. Class Request edit ace Design an inventory class (Inventory.h) that holds the information for an item in a retail store's inventory. Implement the class based on the UML diagram shown below: Inventory private: int itemNumber; int quantity; double cost; I/An int that holds the item's number I/An int that holds the quantity of the item on hand IIA double that holds the wholesale per-unit cost of the item public: Inventory() Inventory(int, int, double); 1/Overloaded constructor. //Default constructor. Sets all the member variables to 0. I/Accepts an item's number, quantity, and cost as arguments. void setltemNumber(int); /I/Accepts an int argument and copies it into the itemNumber member variable. void setQuantity(int); //Accepts an int argument and copies it into the quantity member void setCost(double); IIAccepts a double argument and copies it into the cost member variable int getltemNumber(); I/ Returns the value in itemNumber int getQuantity(); //Returns the value in quantity double getCost(); //Returns the value in cost double getTotalCost(); //Computes and returns the total cost bool validInt(int); I/This function returns true if its integer argument is valid (i.e. non-negative), and returns false otherwise. bool validFloat(double); //This function returns true if its floating-point argument is valid (i.e. non-negative), and returns false otherwise. Implement all the methods specified above to complete the Inventory class. In the tester program, Inventory.cpp, include the following operations. MacBook Pro 000 000 & $ % ) 9 8.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Intermediate SQL concepts
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education