Question

In: Computer Science

Problem: Your have been asked by a cell phone service provider to write a program that...

Problem: Your have been asked by a cell phone service provider to write a program that will calculate the amount of a customer’s monthly bill. Write a C++ program that will calculate the amount of the bill given the number of lines and the amount of minutes used during the month. Unlimited texting is also offered. '

The cellular service provider offers the following options and pricing: One line for $6/month base cost. Two lines for $12/month base cost.

The voice rates are as follows:

• No minutes: $0

• 1-400 minutes: $9 total

• 401-800 minutes: $16 total

• over 800 minutes: $16 + 1.9 cents/minute over 800 Unlimited texting is $5 extra.

Input: The program should ask the user if they have (A) one line or (B) two lines. Then the program should ask the user to input the number of minutes used in the month (no fractional amounts) Then the program should ask if the user has unlimited text messages (Y or N).

For the first two input values, use an if statement to perform input validation. The user should select only A, or B for the number of lines, and the minutes should be between 0 and 44640 (inclusive).

If either input is invalid, the program should ask the user to reenter the value (but only once, no looping).

Do not validate the response to the last question. 1 Processing: Compute the amount of the monthly bill according to the descriptions above.

If the user answered ‘y’ or ‘Y’ to the last question, your program should add $5 to the bill.

Output: Display the amount of the monthly bill with a dollar sign and formatted to 2 decimal places.

Here are 5 different sample executions of the program: How many lines: A. One line B. Two lines A Enter the total number of minutes used during the month: 100 Unlimited text messages? (Y/N): N The amount due for the month is $15.00

How many lines: A. One line B. Two lines B Enter the total number of minutes used during the month: 750 Unlimited text messages? (Y/N): Y The amount due for the month is $33.00

How many lines: A. One line B. Two lines A Enter the total number of minutes used during the month: 850 Unlimited text messages? (Y/N): Y The amount due for the month is $27.95

How many lines: A. One line B. Two lines A Enter the total number of minutes used during the month: 803 Unlimited text messages? (Y/N): y The amount due for the month is $27.06 2 How many lines: A. One line B. Two lines C Please enter A, or B: A Enter the total number of minutes used during the month: 1234567 Please enter a number between 0 and 44640 for the minutes: 500 Unlimited text messages? (Y/N): n The amount due for the month is $22.00

Solutions

Expert Solution

If you have any doubts, please give me comment...

#include<iostream>

#include<iomanip>

using namespace std;

int main(){

    int total_mins;

    char type, isUnlimited;

    double bill;

    cout<<"Display the amount of the monthly bill with a dollar sign and formatted to 2 decimal places. Here are 5 different sample executions of the program:"<<endl;

    cout<<"How many lines: "<<endl;

    cout<<"A. One line"<<endl;

    cout<<"B. Two lines"<<endl;

    cin>>type;

    if(type!='A' && type!='B'){

        cout<<"Please enter A, or B: ";

        cin>>type;

    }

    cout<<"Enter the total number of minutes used during the month: ";

    cin>>total_mins;

    if(total_mins<0 &&total_mins>44640){

        cout<<"Please enter a number between 0 and 44640 for the minutes:";

        cin>>total_mins;

    }

    cout<<"Unlimited text messages? (Y/N): ";

    cin>>isUnlimited;

    if(type=='A')

        bill += 6;

    else

        bill += 12;

    if(total_mins==0)

        bill += 0;

    else if(total_mins<=400)

        bill += 9;

    else if(total_mins<=800)

        bill += 16;

    else

        bill += 16 + (total_mins-800)*0.019;

    if(isUnlimited=='Y' or isUnlimited=='y')

        bill += 5;

    cout<<setprecision(2)<<fixed;

    cout<<"The amount due for the month is $"<<bill<<endl;

    return 0;

}


Related Solutions

Write a program for XXX Phones, a provider of cellular phone service. Prompt a user for...
Write a program for XXX Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minutes used, text messages sent, and gigabytes of data used, and then recommend the best plan for the customer’s needs. A customer who needs fewer than 400 minutes of talk and no text or data should accept Plan A at $29 per month. A customer who needs fewer than 400 minutes of talk and any text messages should accept...
Write a program for XXX Phones, a provider of cellular phone service. Prompt a user for...
Write a program for XXX Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minutes used, text messages sent, and gigabytes of data used, and then recommend the best plan for the customer’s needs. A customer who needs fewer than 400 minutes of talk and no text or data should accept Plan A at $29 per month. A customer who needs fewer than 400 minutes of talk and any text messages should accept...
A friend or yours is considering two cell phone service providers. Provider A charges $100 per...
A friend of yours is considering two cell phone service providers. Provider A charges $100 per month for the service regardless of the number of phone calls made. Provider B does not have a fixed service ree but instead charges $1 per minute for calls. Your friend's monthly demand for minutes or calling is given by the equation p-120-30P, where P is the price of a minute.  With Provider A, the cost of an extra minute is 5 _______ .with...
Research and write a short paper (two pages maximum) about your Canadian cell phone provider. What...
Research and write a short paper (two pages maximum) about your Canadian cell phone provider. What are its mission, strategy, and competitive priorities? How is sustainability incorporated into its strategy, value chain, and operations? The answere should be in Canadian Network Provider Choose Any Rogers Bell Telus Freedom Fido
1. You have been asked to develop a manual for your provider-employer. The manual is to...
1. You have been asked to develop a manual for your provider-employer. The manual is to detail a chemical hvgiene plan (CHP) for all employees in the office. How would you proceed? What should be included In the plan? In the CHP, include three major goals that will ensure the provider-employer's conmpliance with the hazard standard. 2. you have been asked to compile a manual of the SDSS for chemicals used in your workplace. What must be included in the...
How did you use your cell phone? A Pew Internet poll asked cell phone owners about...
How did you use your cell phone? A Pew Internet poll asked cell phone owners about how they used their cell phones. One question asked whether or not during the past 30 days they had used their phone while in a store to call a friend or family member for advice about a purchase they were considering. The poll surveyed 1003 adults living in the United States by telephone. Of these, 462 responded that they had used thier cell phone...
Assume that your company wants to enter into a contract with a regional cell service provider....
Assume that your company wants to enter into a contract with a regional cell service provider. Your company wants to ensure that the contract is for a fixed term of 5 years, and cannot be terminated before that first 5-year term expires, and afterwards is renewable for 5-year terms unless terminated by one year's notice. TELUS does not want the parties to have the ability to terminate the agreement after only one year. The termination clause should only apply to...
CPSC 1103 Assignment 1 Problem A cell phone provider has three different subscription packages for its...
CPSC 1103 Assignment 1 Problem A cell phone 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 unlimited access is provided. Write a program to ask which package the customer has purchased, what month they are using, and how...
Assume you are a senior manager of a cell phone provider such as TELUS, Rogers or...
Assume you are a senior manager of a cell phone provider such as TELUS, Rogers or Bell. How might your (cell phone provider) costs of production be affected in the short-run and long-run? (approx. 230 words)
You have been asked to write program that allows the user to input a first name,...
You have been asked to write program that allows the user to input a first name, middle initial (without the period), and last name of a user and then display that person’s name with the first, middle initial followed by a period, and last name last. BEFORE creating the program, use structured programming principles to document how you are going to develop the program. Use Microsoft Word to complete this part of the assessment. Answer each of the following areas:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT