Header HomeContact
.


Specializing in removing viruses, reinstalling operating system on laptop, desktop, network. Installing software, applications, utilities, antivirus, repair. Serve Atlanta, Mcdonough, Ellenwood, Stockbridge, college park. Professional computer technician.

 

 

C++ Code

Markup:

Write a program that asks the user to enter an item's wholesale cost and it's markup percentage. It should then display the item's retail price.

The program should have a function name - calculateRetail - that receives the wholesale cost and the markup percentage as arguments, and return the retail price of the item.


#include <iostream>
#include <iomanip>
using namespace std;

double calculateRetail(double wholesaleCost, double markupPercent)
{

double retailPrice;
retailPrice = (wholesaleCost * markupPercent) + wholesaleCost;
return retailPrice;

}

int main()
{
double wholesaleCost;
double markupPercent;
double total;

double calculateRetail( double, double);

//Enter Wholesale Price
cout << "Please Enter wholesale Price: $";
cin >> wholesaleCost;

if( wholesaleCost < 0 )
{
cout << "Error! Enter a postive number: $";
cin >> wholesaleCost;
}

//Enter Markup Percentage
cout << "Please Enter markup percent: ";
cin >> markupPercent;

if(markupPercent < 0)
{
cout << "Error! enter a postive number ";
cin >> markupPercent;
}

markupPercent = markupPercent * .01;

//This is the function call
total = calculateRetail(wholesaleCost, markupPercent);

cout << fixed << setprecision(2);
cout << "The retail price is $" << total << endl;
cout << endl;

system ("pause");
return 0;
}

 

Go To Top