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
What is the best brand of folders
kolezko [41]
Five star is what I hve used for years. They don't tear and are durable and have lots of colors
8 0
3 years ago
Read 2 more answers
Question is on the picture thank you
andreyandreev [35.5K]

I've included the spin and main method. I also included the public class. You can just ignore everything besides the spin method.

8 0
3 years ago
What do vector handles point at?
mylen [45]

Answer: I think the answer is A

Explanation:

If i'm wrong i'm sorry

7 0
3 years ago
Read 2 more answers
Let x = ["Red", 2.55,"Green", 3,"Black","false"], then solve the following:
blagie [28]

Answer:

  • Print(x) would be directly calling the x variable so it would print everything but the []
  • Print(x[10]) is calling the number 10 which results in E
  • 2 + d= 2d

3 0
3 years ago
You already know how to use lists. What is the index of 5 in the following list?
otez555 [7]
The answer is 1, the 3rd circle
5 0
3 years ago
Other questions:
  • Write a static method, getBigWords, that gets a single String parameter and returns an array whose elements are the words in the
    15·1 answer
  • "Which of the following will help protect against a brute force attack?
    11·1 answer
  • Which of the following is a true statement? Question 33 options: Data entities correspond to sources/sinks on a data flow diagra
    14·1 answer
  • Networks that are designed to connect similar computers that share data and software with each other are called:
    10·1 answer
  • Arrays are described as immutable because they are two dimensional. are arranged sequentially. can be reordered. cannot be chang
    11·1 answer
  • Generally considered to be the most important information security policies, what item below defines the actions a user may perf
    11·1 answer
  • A Tracking Gantt chart is based on the percentage of work completed for project tasks or the actual start and finish dates. True
    12·1 answer
  • kieran wants to search a database quickly for information on the last time a patient came to his medical facility.The informatio
    14·2 answers
  • Dimensional arrays can be created using loops. 2 dimensional arrays can be created using:
    10·1 answer
  • 6. kinukuha nito ang kabuuang bilang ng mga numerical na datos sa mga piniling cells
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!