Lab Practical 2
Define a structure of type Product. The member variables should be code (int), wholesale_price (double), retail_price (double), number (int), and reorder_val (int).
Write the definition of an initiation function:
void init_product(Product& new_product)
This function should initialize all member variables of the passed Product object.
The function should prompt the user for the product code, the wholesale price, the number in stock, and the reorder value for this product.
The function should only allow the user to enter values between 1000 and 9999 for the product code.
All products have a 10% markup, so the function should calculate the retail price as 1.1 times the wholesale price.
Write a driver program to test this function.
Add a function to your program that will output your Product information in the following format:
code W cost R cost # in stock Reorder # ---- -------- -------- ---------- --------- 1111 $ 10.00 $ 11.00 15 50 2222 $ 100.00 $ 110.00 100 10 3333 $ 5.00 $ 5.50 12000 100
Your output function should just output one Product object. So, the preceding example would need 3 calls to this function to output the 3 products (1111, 2222, 3333). So, the column headings would need to be output before these function calls.
Your program should prompt the user to enter info for 3 products. Then output the inventory in the above format.
Modify your program so that it will only output to the screen all items that need to be reordered. A product needs to be reordered if its # in stock is lower than its reorder #. In the previous example in Part 3, product 1111 would need to be reordered since its # in stock, 15, is lower than its reorder #, 50.