8.3k views
1 vote
An internet service provider has three different subscription packages for its customers.  Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour.  Package B: For $14.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour.  Package C: For $19.95 per month unlimited access is provided. Your task is to write a program that calculates a customer's monthly bill. The program must ask the user which package the customer has purchased and how many hours were used for the current month. It must then display the total amount due. In addition to calculating the monthly bill for the user's current package, your program must do the following: display how much money Package A customers would save if they purchased packages B or C, and how much money Package B customers would save if they purchased Package C. If there would be no savings, no message will be printed for a particular case.

User Skrilled
by
5.9k points

1 Answer

4 votes

Answer:

C++.

Step-by-step explanation:

int main() {

const float package_A = 9.95;

const float package_B = 14.95;

const float package_C = 19.95;

const int package_A_extra = 2;

const float package_B = 1;

/////////////////////////////////////////////////////////////////////////////

int user_package_choice;

int hours_used;

cout<<"Your package? Enter option number,"<<endl;

cout<<"1. Package A"<<endl<<"2. Package B"<<"3. Package C";

cout<<endl;

cin<<user_package;

cout<<endl;

cout<<"Hours used?: ";

cin<<hours_used;

/////////////////////////////////////////////////////////////////////////////

cout<<endl;

float total_amount;

if (user_package_choice == 1) {

total_amount = package_A + ((hours_used - 10) * package_A_extra));

if (total_amount - (package_B + ((hours_used - 20) * package_B_extra)) > 0)

cout<<"If you had opted for Package B, you would have saved $"<<total_amount - (package_B + (hours_used * package_B_extra))<<endl;

if (total_amount - package_C > 0)

cout<<"If you had opted for Package C, you would have saved $"<<total_amount - package_C;

}

else if (user_package_choice == 2) {

total_amount = package_B + ((hours_used - 20) * package_B_extra);

if (total_amount - package_C > 0)

cout<<"If you had opted for Package C, you would have saved $"<<total_amount - package_C;

}

else {

total_amount = package_C;

}

return 0;

}

User Sebsemillia
by
7.5k points