Using Borland 4.5, yea its old but this is what my teacher prefers.
Problems States:
Markup
Write a program that asks the user to enter and item's wholesale cost and its markup percentage. It should then display the item's retail price. For Example
If an item's wholesale cost is 5.00 and its markup percentage is 100% then the item's retail price is 10.00
If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50
The Program should have a function named calculateRetail that receives the wholesale cost and the markup percentage as arguments, and returns the retail price of the item.
Input Validation: Do not accept negative values for either the wholesale cost of the item or the markup percentage.
and this is what I have so far.
#include <iostream.h>
#include <iomanip.h>
void calculateRetail(double, double, double, double);
//Function where the retail price is calculated
int main()
{
double wCost; // To hold the whole sale cost of the item
double mPercent; // To hold the mark up price percentage of the item
double markup; // To hold the decimal form of the markup
double retailPrice; // To hold the retail price
cout << "This program finds the retail price of an item" << endl;
cout << "Enter the item's wholesale cost." << endl;
cin >> wCost;
cout << "Enter the markup percentage." << endl;
cin >> mPercent;
cout << setiosflags(ios::showpoint | ios::fixed);
cout << setprecision(2);
if (mPercent < 0 || wCost < 0)
cout << "Please enter a number above zero for both wholesale cost and" <<
cout << " markup percentage!" << endl;
else
cout << " The retail price is $" << retailPrice << endl;
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// The function takes the values of markup and whole sale cost and multiplies /
// them to get the retail cost. Before they are multiplie, the percentage is /
// converted to decimal form so that it can be multiplied. /
///////////////////////////////////////////////////////////////////////////////
void calculateRetail(double wCost, double mPercent, double markup, double retailPrice)
{
markup = mPercent / 100;
retailPrice = wCost * markup;
}