1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sineoko [7]
3 years ago
5

Here is the problem specification: An Internet service provider has three different subscription packages for its customers: Pac

kage 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.
Computers and Technology
1 answer:
Andrej [43]3 years ago
6 0

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

<em>                bill = hour * 9.95;</em>

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

End of A package:            break;

For 'B' package

           case 'B':

Calculate the bill

<em>                bill = hour * 14.5;</em>

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

End of B package:<em>            </em>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: <em>else{ cout<<"Hour must be 0 - 744"; }</em>

You might be interested in
Which group on the Note Master tab contains the command to add footers to the notes pages?
nasty-shy [4]

Answer:

Place Holders

Explanation:

5 0
3 years ago
Can someone please do a java computer science program for me? I’m desperate and I did not have enough time to learn the topic. I
vagabundo [1.1K]
Sure, how would you like me to send you the code?
5 0
3 years ago
What is the point of having bullets points in a text box
Ludmilka [50]
You should have bullets in a text box in case you have a list of stuff. For example:

Computer Parts

.Tower

.Monitor

. Mouse

.Printer


3 0
3 years ago
Cuál es la diferencia entre hackeo y crackeo
Sauron [17]

Answer: El hackeo es el proceso de intrusión en los sistemas informáticos sin autorización para acceder a ellos, con buenos o malos propósitos, el cracking es la misma práctica aunque con intención delictiva.

3 0
3 years ago
(in order of a-z)
Lerok [7]

Answer:

Airplane

Balloons

Bookmark

Boot

Chips

Cup

Dog

Flowers

Glove

Hat

Lamp

Notebook

Orange

Pen

Poster

Scissors

Snake

Telephone

Turtle

6 0
2 years ago
Other questions:
  • For some people , alcohol can cause an uncontrollable blank of the eyes , making good vision almost impossible
    5·1 answer
  • How many host ip addresses are available on a network with a subnet mask of 255.255.255.192?
    6·1 answer
  • Why is television reactive, requiring no skills or thinking
    11·1 answer
  • Up to 10 people is a good guideline for the size of your study group.
    15·1 answer
  • Given that k refers to a non-negative int value and that t has been defined and refers to a tuple with at least k+1 elements, wr
    12·1 answer
  • If someone you don”t know asks where you go to school, what should you do?
    7·2 answers
  • The next few questions will be based on interpretations of a topographic map from East Brownsville, TX. To answer these question
    15·1 answer
  • Which of the following internet protocols is used to request and send pages and files on the World Wide Web
    13·1 answer
  • when two people are in a race, what do you need to know to determine who is the fastest 1 units of speed that are identical 2 th
    10·1 answer
  • There is a development team delivering a new software package with agile and devops frameworks. in one of the releases, the auto
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!