Here is the problem specification: 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. Write a program that calculates a customer's monthly bill. It should ask which package the customer has purchased and how many hours were used. It should then display the total amount due. Input Validation: Be sure the user only selects package A, B or C. Also, the number of hours used in a month cannot exceed 744. Use switch.

Answers

Answer 1

Answer:

In C++:

#include <iostream>

using namespace std;

int main(){

   int hour; char pkg; float bill = 0;

   cout<<"Package: "; cin>>pkg;

   cout<<"Hour: "; cin>>hour;

   if(hour<=744 && hour >=0){

       switch (pkg) {

           case 'A':

               bill = hour * 9.95;

               if(hour >10){bill = 10 * 9.95 + (hour - 10) * 2;}

           break;

           case 'B':

               bill = hour * 14.5;

               if(hour >10){bill = 20 * 14.5 + (hour - 20) * 1;}

           break;

           

           case 'C':

               bill = 19.95;

           break;

           

           default:

               cout << "Package must be A, B or C";}

cout<<"Total Bills: $"<<bill; }

else{ cout<<"Hour must be 0 - 744"; }

return 0;

}

Explanation:

This declares all variables:    int hour; char pkg; float bill=0;

This prompts the user for package type:  cout<<"Package: "; cin>>pkg;

This prompts the user for number of hours:    cout<<"Hour: "; cin>>hour;

This checks if hour is between 0 and 744 (inclusive)

   if(hour<=744 && hour >=0){

If true, the following is executed

A switch statement to check valid input for package

       switch (pkg) {

For 'A' package

           case 'A':

Calculate the bill

               bill = hour * 9.95;

               if(hour >10){bill = 10 * 9.95 + (hour - 10) * 2;}

End of A package:            break;

For 'B' package

           case 'B':

Calculate the bill

               bill = hour * 14.5;

               if(hour >10){bill = 20 * 14.5 + (hour - 20) * 1;}

End of B package:            break;

For C package            

           case 'C':

Calculate bill:                bill = 19.95;

End of C package:            break;

If package is not A, or B or C

           default:

Prompt the user for valid package                cout << "Package must be A, B or C";}

Print total bills: cout<<"Total Bills: $"<<bill; }

If hour is not 0 to 744: else{ cout<<"Hour must be 0 - 744"; }


Related Questions

Other Questions
Compute the scale factor, as a percent, for each given relationship. Drawing 1 to Drawing 2.A) 210%B) 47.61%C) 2.1 D) 0.47169Need help and fassttttttt!!!!!plzzz The pituitary gland is most similar to:A A worker in a factoryB A mail carrierC The boss of a big officeD A security guard or police officer What is a in the parallelogram Vaughn threw the shot put 9 yards at a track meet. The official used a tape measure to measure the distance in feet. How many feet did he throw the shot put? What did Johnny decide when they were at the Dairy Queen and Dally was talking about other places to hide? a flagellated protist is called a ? "But soft! What light through yonder window breaks?" (Romeo and Juliet, Act II, scene ii) PLEASE TRANSLATE INTO MODERN ENGLISH!!!! In what ways did the Han Dynasty change policies that the Qin dynasty established? Two charged spheres 10 cm apart attract each other with a force of 3.0 x 10^-6 N. What electrostatic force will result if both charges are doubled and the distance remains the same? sum of 500 consecutive integers is 250 . what is the product same 500 numbers How many vehicles are at Nam's Gas Station? What is a good thing about a turn over of power in the government Harriets high school recently built a new state-of-the-art football stadium to improve their athletics, though Harriet believed the money could have been better spent renovating the aging library. What element of local government should Harriet get involved with in order to influence funding decisions such as this in the future? Select one: A. City School Board B. Department of Human Services C. Department of Transit D. Department of Code Enforcement What happens to the effenciency of the exchange of oxygen in the human body at a high altitude The Slavs settled in most of Eastern Europe.TrueFalse Melissa Shallowford contributed a patent, accounts receivable, and $22,340 cash to a partnership. The patent had a book value of $8,650. However, the technology covered by the patent appeared to have significant market potential. Thus, the patent was appraised at $92,840. The accounts receivable control account was $34,300, with an allowance for doubtful accounts of $2,200. The partnership also assumed a $9,010 account payable owed to a Shallowford supplier.Required: On December 31, provide the journal entry for Shallowford's contribution to the partnership Rotor to the chart of accounts for the exact wordino of the account titles ONOW journals do not use ines for journal explanations. Every Ave on a journal page is used for debitor credil entries CNOW journals wol automatically indont a credit entry when a credit amount is entered. Q5. Use Superposition to V. in the circuit below? (5 points)4 mA12V2 2 mA1 2 5 for $4.45 or 8 for $7.28 Why is it important to be a good digital citizen? 2-3 sentences PLEASE HELP. it is in the attachment