Help with display.

I can not get the by switching packages to 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;
		}
		}
		}
		}
			
Put the code you need help with here.
[/code]
FORMATTING!!!!!!!!!! Your code never gets to the part where is checks for the packages.
what happens is that is fives you the results and breaks out of the switch case. below is your actual code tabbed correctly ("NOTE! how the whole code is included inside your first if on case A.

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
#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;
				}
			}
	}
}



HERE is the correct structure for the switch follow it and adjust your code.

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
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;
}



Note the scope of each case and the if statement inside of it!! Hope that helped.
Topic archived. No new replies allowed.