I am trying to write a program that asks for the wholesale cost of an item and its markup percentage, and displays the retail price.
Well, I did that the regular way, but...
My instructions require for me to:
- Create a function that accepts the wholesale cost and markup percentage as arguments
- Returns the retail price of the item
- Do not accept negative values for either the wholesale cost of the item or the percent markup.
I have read my book, but I have no idea how to create a function for wholesaleCost and markupPrice. I tried, but I got an error.
Here is my regular program (without the user-defined function):
Does anyone have any idea how I can do this?? Any input is appreciated.
using namespace std;
double wholesaleCost, markupPercentage, markupAmount, retailPrice;
cout << "What is the wholesale cost of the item? ";
cin >> wholesaleCost;
cout << "What is the markup percetage for this item? ";
cin >> markupPercentage;
markupAmount = wholesaleCost * markupPercentage;
retailPrice = wholesaleCost + markupAmount;
cout << fixed << showpoint <<setprecision(2);
cout << "Your retail price for this item is $" <<retailPrice <<endl;