• Forum
  • Lounge
  • The switching to a different Pac will no

 
The switching to a different Pac will not display

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
#include<iostream>
#include<cctype>
using namespace std;

int main()
{
	char package;
	double units;
	double fees_a, fees_b, fees_c;
	int A, B, C, Q;
	double pac_a,pac_b, pac_c;
	do
	{
	 do
		{
	cout <<"Which pakage are you shopping for?:Please enter A, B, C, or Q to quit."<< endl;
	cin>> package;
	cout<<"How many message units?:"<<endl;
	cin>>units;
		 package = toupper(package);
	}while(package !='A' && package !='B' &&	package !='C' && package !='Q');
	}while(units < 0 || units >672);
			switch(package)
	{
		case 'A':
		
				
		if (units <=10)
		{
		fees_a = 9.95;
		cout<<"The charges are:"<< fees_a<< endl;
		}
	else
	{
		(units > 10);
		
		fees_a = (units - 10) * 2 + 9.95;
		cout<<"The charges are:"<< fees_a<< endl;
		break;
		
		case 'B':
		
			
      if (units <= 20)
		{
		fees_b = 19.95;
		cout<<"The charges are:"<< fees_b<< endl;
      }
	 else (units >20);
	 {
			fees_b = ((units - 20) + 19.95);
			cout<<"The charges are:"<< fees_b<< endl;
		}	
			break;
			case 'C':
		        
			fees_c = 39.95;
			
			cout<<"The charges are:"<< fees_c<< endl;
		
			break;
					
		case 'Q':
								
			cout<<"Thank you for using this program. Goodbye."<< endl;
			break;
			default:
			cout<<"Enter only 0 through 672."<<endl;
	
	if(fees_a < fees_b && fees_a < fees_c)
	{
		cout<<"Package A is a better plan"<< endl;
	}
	else if(fees_b < fees_c)
	{
		pac_b = (fees_a - units + 19.95) +20;
		pac_c = (fees_a - 39.95);
		
		cout<<"By switching to package B you would save:$"<<pac_b<<endl;
		cout<<"By switching to package C you would save:$"<<pac_c<<endl;
		
	}
	else
	{
		cout<<"Package C is a better plan"<<endl;			
			
		
					
		return 0;
		}
		}
		}
		}
			
closed account (3qX21hU5)
This thread is more suited towards beginner section of this website. You might want to move it there, since you will get more help there.
gyneisler, It looks like you have a '}' out of place. Look at the else in case 'A':.

PS: I also recommend you spend some time learning a neater formatting style. ;0)
Last edited on
Topic archived. No new replies allowed.