Questions about differences

I need to modify my program so it also displays money Package A customers would save if they were to purchase packages B or C, and how much money Package B customers would save if they purchased Package C. if no savings, then nothing to be printed.

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
  #include <iostream>
#include <cmath>
#include <iomanip>        //header file used because of 'setprecision'
using namespace std;

int main ()
{
	int choice;         // For the choiced the user will choose
	int hours;          // For hours used per month
	double charges;     // holding charges

	{
	//Constants for packages
	const double 
		PACKAGE_A = 9.95,
		PACKAGE_B = 14.95,
		PACKAGE_C = 19.95;

	//Constants for menu selection
	const int
		PACKAGE_A_CHOICE = 1,
		PACKAGE_B_CHOICE = 2,
		PACKAGE_C_CHOICE = 3,
		QUITTING_CHOICE = 4;

	//Displaying the menu
	cout << "\t\tInternet Service Provider Menu\n\n"
		 << "1. Package A\n"
		 << "2. Package B\n"
		 << "3. Package C\n"
		 << "4. Quit this Program\n"
		 << "-----------------------\n"
		 << "Enter in a choice: ";
	cin >> choice;

	//this is so the monthly bill is displayed with 2 decimal points
	cout << fixed << showpoint << setprecision(2);

	//Response to users package selection with if/else if statements
	if (choice == PACKAGE_A_CHOICE)
	{
		cout << "How many hours used on the internet? ";
		cin >> hours;
		charges = (2.00 * (hours - 10)) + PACKAGE_A;         //Math calculating monthly charges
		cout << "The total monthly charges are $" << charges << endl;
	}
	else if (choice == PACKAGE_B_CHOICE)
	{
		cout << "How many hours used on the internet? ";
		cin >> hours;
		charges = (1.00 * (hours - 20)) + PACKAGE_B;         //Math calculating monthly charges
		cout << "The total monthly charges are $" << charges << endl;
	}
	else if (choice == PACKAGE_C_CHOICE)
	{
		cout << "How many hours used on the internet? ";
		cin >> hours;
		charges = (0.00 * hours) + PACKAGE_C;         //Math calculating monthly charges
		cout << "The total monthly charges are $" << charges << endl;
	}
	else if (choice == QUITTING_CHOICE)
	{
		cout << "The Program will now end.\n";    //Displays this if option 4 is selected
	}
	else
	{
		cout << "Please select a valid choice 1 through 4.\n"
			<<"Run the program again and select one of the valid options.\n";
	}
	system ("PAUSE");
	return 0;
}
Copy the calculations you want to the "if" you want. ;) But to calculate the difference you'll need to create a couple of variables.
Topic archived. No new replies allowed.