Functions Problem, Help?

I have to code for functions.
1. GetWholeSale() - ask for user's whosale, validate, and return
2. GetMark() - enter markup, validate, and return
3. CalculateRetail() - calculate retail price, return, takes wholesale and markup pass from main // I don't know how to pass from main!
4. Report() - print retail price passed from main. does not return value.

This is what I have. How could I improve/ or fix the program so it runs in accordance to the directions. All I need is alittle guidance!

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <iostream>
#include <iomanip>
double GetWholeSale();
double GetMark();
double CalculateRetail( double, double );
void Report( double );
using namespace std;

void main()
{
	char choice; 
	do
	{
		double catchCost = GetWholeSale();
		double catchMarkup = GetMark();
		void report( );
		cout << "Do you want to do another markup? Enter Y to continue, N to stop: ";
		cin >> choice;
	}
	while ( choice == 'Y');

}
/************** User inputs an item's whole sale************************************/
double GetWholeSale()
{
	int cost;
	cout << " Enter the item's whole sale cost: ";
	cin >> cost;
	while ( cost < 0 )
	{
		cout << "Enter a POSITIVE number for whole sale: ";
		cin >> cost;
	}
	return cost;
}
/************************ User enters mark up**********************/
double GetMark()
{
	double percentage;
	cout << "Enter the item's mark up percentage: ";
	cin >> percentage;
	return percentage;
}
/************************* Calculate and Return retail price*************************/
double CalculateRetail(double percentage , double sale )
{
	double retailmarkup, retail;
	retailmarkup = percentage * sale;
	retail = percentage + sale;
	return retail;
}
/************************* Report the retail price*********************************/
void report ( double retail)
{
	cout << " The retail price is: " << retail << endl; 
}
Last edited on
Topic archived. No new replies allowed.