FUNCTIONS WITH DIFFERENT RETURN TYPES AND PARAMETERS

NuMetro has a special on movies for all members of the public but special discounts for students and pensioners. If pensioners or students buy a movie ticket they receive 10% if they buy a movie and popcorns, they receive 20% discount. Other customers only receive a discount when they buy a movie ticket and popcorns, there is no discount for just a movie ticket alone. Write a program named question6b.cpp that will consist of two functions. The program must prompt the user for type of customer („p‟ for pensioner, „s‟ for student, „o‟ for other). It must then call the relevant function according to that entry. The first function must receive the customer type and calculates discount for pensioners and students. The second function calculates the discount for customers that are not pensioners or students.

My code below is not running, pleaase help

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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  #include <iostream>
using namespace std;

double amount;
double studendOrPensioner(int&choice, double &origPrice);
double OtherCustomers(int&choice,double& origPrice);

int main()
{
int customertype;

cout<<"s. Student\n";
cout<<"S. Student\n";
cout<<"p. Pensioner\n";
cout<<"P. Pensioner\n";
cout<<"O. Other customers: ";
cin>> customertype;
switch ( customertype ) {
case 's':
case 'S': 
case 'p': // Note the colon, not a semicolon
case 'P':
cout << "You have selected pensioner or student" << endl;
double studendOrPensioner(int&choice, double &origPrice);
break;
case 'o':
case 'O': // Note the colon, not a semicolon
cout<<"You have selected other customers ";
double OtherCustomers(int&choice,double& origPrice);
break;
}
cin.get();
}
double studendOrPensioner(int&choice,double& origPrice)
{
cout << "You have selected a student or a pensioner ";
cout << "Enter choice ";
cout << "100 for ticket only";
cout << "200 for ticket and popcorn";
cin >> choice;
if (choice == 100){
cout << "Please enter the original price: ";
cin >> origPrice;
return origPrice - (origPrice * 20 / 100);
} else
{

#include <iostream>
using namespace std;

double amount;
double studendOrPensioner(int&choice, double &origPrice);
double OtherCustomers(int&choice,double& origPrice);

int main()
{
int customertype;

cout<<"s. Student\n";
cout<<"S. Student\n";
cout<<"p. Pensioner\n";
cout<<"P. Pensioner\n";
cout<<"O. Other customers: ";
cin>> customertype;
switch ( customertype ) {
case 's':
case 'S': 
case 'p':
case 'P':
cout << "You have selected pensioner or student" << endl;
double studendOrPensioner(int&choice, double &origPrice);
break;
case 'o':
case 'O': 
cout<<"You have selected other customers ";
double OtherCustomers(int&choice,double& origPrice);
break;
}
cin.get();
}
double studendOrPensioner(int&choice,double& origPrice)
{
cout << "You have selected a student or a pensioner ";
cout << "Enter choice ";
cout << "100 for ticket only";
cout << "200 for ticket and popcorn";
cin >> choice;
if (choice == 100){
cout << "Please enter the original price: ";
cin >> origPrice;
return origPrice - (origPrice * 20 / 100);
} else
{

double OtherCustomers(int&choice,double& origPrice)
{cout << "You have selected a student or a pensioner ";
cout << "Enter choice ";
cout << "100 for ticket only";
cout << "200 for ticket and popcorn";
cin >> choice;
if (choice == 100){
cout << "Please enter the original price: ";
cin >> origPrice;
return origPrice - (origPrice * 20 / 100);
}
else {
origPrice;}
}

}

}
Let's start with what error message you are receiving. Just copy and paste it to this thread.
Topic archived. No new replies allowed.