C++ A local goldsmith has asked you to create a program that can hold inventory
ID: 645522 • Letter: C
Question
C++
A local goldsmith has asked you to create a program that can hold inventory information, hold the current value of two metails and produce sales data. Design a program using an Inventory class, a Metals-value class, and a Sales class. Use a menu to allow her to access or retrieve data for the 3 classes. All the variables will be private and all the member functions will be public.
Inventory Class information:
Item no (>0)
date_created (month/date) (not empty)
description (<=20 chars)
grams of gold used (>=0)
grams of silver used (>=0)
price of gold/gram on the day the piece was created (>0)
price of silver/gram the day the piece was created (>0)
value of gemstones used (>=0)
hours of labor (>=0)
cost of materials (calculated)
wholesale price (cost_of_materials*2 + hours_of_labor*30)
retail price (wholesale_price * 2)
available (bool, initialize to 'yes' and set to 'no' if it sells)
---------------------
Metal_Values_Class
gold_price_per_gram (>0)
silver_price_per_gram (>0)
----------------------
Sales Class
item no (must be an item that is listed in the Inventory class and it must be listed as still available)
price_sold (>=0)
tax (=price_sold * 0.8)
total_due (calculated)
------------
For each class, create the accessor and mutator and two constructor functions. The mutator functions should have a their own of validation protection as described in the lists above. Remember, your data is protected by it's member functions. You can't trust anybody!
-----------
Program Interface:
Menu
1. Add Inventory
2. List Inventory
3. Update Metals Values
4. Create Sales Receipt
5. Exit Program
The program should loop until the user chooses Option 5.
------------
High-level Validation:
Menu options 1-5
All user input validated at the time of input. The user is given an error message and the opportunity to input again. That means that there will actually be two layers of validation: The lower-level that is embedded in the mutator functions to protect the data (and causes an exit_failure) and the upper-level that is in the calling functions that validates the user's input.
-------------
How to Demo your program:
Create an array of 5 Inventory objects
Create one (1) Metals object
Create an array of 2 sales objects
Use the menu to update the Metals_Value object to realistic prices (look this up)
Use the menu to add 5 new pieces of jewelry to the Inventory objects array
Use the menu of display the Inventory objects array
Use the menu to sell a piece of jewelry
Use the menu to display the Inventory Objects array
Use the menu to sell another piece of jewelry
Use the menu to display the Inventory Objects array
Explanation / Answer
/*-------------------Inventory Class--------------------*/ class Inventory { char itemNo[2],itemName[20]; int gram_of_gold; int gram_of_silver; float Price_of_silverpergram ; float Price_of_goldpergram; int gemused; int labor; date datecreated[date]; float com; Boolean available; Float Wholesale_price; Wholesale_price= cost_of_materials*2 + hours_of_labor*30; Float retail_price= Wholesale_price * 2; double price,amt; char description[40]; public: void addRec(); void dispRec(); void chqrec(); }; Class Metal_values() { Float Price_of_goldpergram>0; Float Price_of_silverpergram> 0; }; Class Sales() { Char itemNo[2]; Float Price_sold>=0; Float tax= Price_sold * 0.8; Int total_due; } --------------------------------------------------------------------------end void main() int menu() { long selection; int choice; selection = menu(); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.