back again this time with functions.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <iomanip>
using namespace std;

double CalculateRetail(double, double);
 
int main()

{
	double wholesaleCost, markupPercentage, retailPrice;
	cout << "What is the wholesale cost of the item? ";
	cin >> wholesaleCost;
	cout << "What is the markup percetage for this item? ";
	cin >> markupPercentage;
	retailPrice = CalculateRetail(wholesaleCost, markupPercentage);
	
	cout << fixed << showpoint << setprecision(2);
	cout << "Your retail price for this item is $" << retailPrice << endl;
	cin.get();
	return 0;
}
 
	double CalculateRetail(double wholeSale, double markUpPercent)


{
	return wholeSale * markUpPercent;
}

i got this code right here to figure out the retail price giving the markup percentage and the wholesale cost. the calculation is giving me the wrong answer. i put in 5.00 for wholesale cost and 100% for markup percentage and it gives me $500.00. but it suppose to be $10.00 can u tell me why.
closed account (z05DSL3A)
1
2
3
4
double CalculateRetail(double wholeSale, double markUpPercent)
{
     return (wholeSale + (wholeSale * markUpPercent / 100.0 ) );
}
Last edited on
Topic archived. No new replies allowed.