point me in the right direction pls!

I have a pretty decent grasp on value returning functions but having a little trouble with the voids. Just need a little push in the right direction. Heres the program:

A dept store wants a program that displays the # of reward points a customer earns each month (based on the customers membership type and total monthly purchase amount)

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
57
58
  #include <iostream>
#include <iomanip>
using namespace std;

//function prototypes
void displayStandard(double totalBalance);
void displayPlus(double totalBalance);
void displayPremium(double totalBalance);

int main()
{
	double balance = 0.0;
	int points = 0;

		cout << "Please enter your monthly balance: ";
		cin >> balance;


	displayStandard(points);
	displayPlus(points);
	displayPremium(points);



	system("pause");
	return 0;
}//end of main

//*****function definitions*****
int rewards = 0;
void displayStandard(double totalBalance)
{
	if (totalBalance < 75)
		rewards = .05 * totalBalance;
	
	else if (totalBalance >= 75 && totalBalance <= 149.99)
		rewards = .075 * totalBalance;

	else (totalBalance >= 150);
	rewards = .10 * totalBalance; 

}

void displayPlus(double totalBalance)
{
	if (totalBalance < 150)
		rewards = .06 * totalBalance;
	else
		rewards = .13 * totalBalance;
}

void displayPremium(double totalBalance)
{
	if (totalBalance < 200)
		rewards = .04 * totalBalance;
	else
		rewards = .15 * totalBalance;
}
but having a little trouble with the voids.

You never mention what kind of trouble and what the problem actually is here, so I dont know what you need help with.
touche....I can't seem to figure out how to get the reward points to show.
Can't you simply print out the points?

cout << totalbalance;

If this is not what you're looking for, and Im guessing it's not. Please make a bit more of an effort explaining what you want to do in detail.
The only other spec the program has is "The program should use a separate void function for each membership type".

What I am trying to do is have the user input their balance and then call the void functions to display the rewards points for the 3 tiers (standard, Plus, and Premium)

We are also learning how to pass by reference so I'm not sure if I should be using this for this particular program
If all you want to do is display the reward in all 3 functions, why can't you simply print out the reward in the functions?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
void displayStandard(double totalBalance)
{
	if (totalBalance < 75)
		rewards = .05 * totalBalance;
	
	else if (totalBalance >= 75 && totalBalance <= 149.99)
		rewards = .075 * totalBalance;

	else (totalBalance >= 150);
	rewards = .10 * totalBalance; 

        cout << "Reward points for standard: " << rewards;

}
Last edited on
Thanks for your timely help Tarik, but wife and kids aren't going to seem to let me work in quiet..... I did what you suggested I'll try to work it out tomorrow and if need be come back. Thanks again
Topic archived. No new replies allowed.