[solved]-Task Welcome Piggly Wiggly Short Program Code Test Two Functions According Specs Read Spe Q38995511
Your Task
Welcome to Piggly Wiggly! In this short program you will code andtest two functions according to the specs below. Read the specscarefully!
Note: For both functions in this program, you may define thefunctions either above or below main. If below main, you will haveto add function prototypes above main.
Function 1: calcUnitPrice
Write a function called calcUnitPrice that will calculate the priceper ounce of a given grocery item. Your function will have a returntype of void and the following three parameters:
⦁ A string representing the item name (e.g.,“Cherrios”)
⦁ A float representing the number of ounces in thepackage
⦁ A float representing the price of the item
Your function will compute the unit price (i.e., price per ounce)by dividing the item price parameter value by the number of ouncesparameter value. Your function will also have a cout statement todisplay the unit price to two decimal places. Example:
Unit price for Cherrios: $0.26 per ounce
Testing the calcUnitPrice Function
In main, test the calcUnitPrice function by calling it two times,using the following test data:
⦁ Cherrios, 19.5 ounce box for $4.99
⦁ Jif Peanut Butter, 28 ounce jar for $3.84
The test output will be:
^Note! That output is produced by a cout statement in yourcalcUnitPrice function, not in main()!
Function 2: getPrize function
In the same program file, add a function called getPrize thatmimics a prize machine at the front of a grocery store. ThegetPrize function will return a string and also have one integerparameter called “cents.” The getPrize function will evaluate theamount in the cents parameter: if 5 cents, the function will returnthe string “fake spider”; if 10 cents “tattoo book”; if 25 cents“fake diamond ring”. You may be creative and make up your ownprizes if you wish.
You will have to use an if/else if… structure to make this work, orelse the switch statement if you prefer it.
Also, don’t forget your double equal sign! ==
Testing the getPrize Function
In main, test the getPrize function by calling it and passing amoney amount (5, 10, or 25). Recall that this function returns avalue (i.e., a string representing the prize), so you will have todo something with that value, such as insert it into the outputstream. For example, in main, your function call might appear likethis:
cout << “nEnjoy your ” << getPrize(10) << “.”<< endl;
In this case the 10 cent prize will be displayed (“Enjoy yourtattoo book.”).
Note: There are NO cout statements in the getPrize function. Theprize string is returned to main and printed via a cout statementin main.
Expert Answer
Answer to Your Task Welcome to Piggly Wiggly! In this short program you will code and test two functions according to the specs be… . . .
OR

