Question

In: Computer Science

Design and implement a C++ program with functions to calculate the pre-tax charge: If the customer...

Design and implement a C++ program with functions to calculate the pre-tax charge:
If the customer subscribes to a phone plan called Plan200, then he is charged $5 for the first 200 minutes. For each additional minutes, the customer will be charged $0.10.
If the customer subscribes to a phone plan called Max20, then he is charged $0.05 for each minute up to $20. (I.e., the customer never needs to pay more than $20.)
If the customer is not subscribed to any phone plan, then he is charged $0.10 for each minute of the phone calls.

To find out whether and which plan the user is subscribed to, your program can display a message such as:
Please choose one of the following options:
Enter A if you are subscribed to Plan200;
      B if you are subscribed to Max20; or
      any other keys if you are not subscribed to any plan.
Your choice:
And then read the user's input. You can use numbers instead of characters.
You can also choose to give the user a free hand to enter this information, such as:
Please enter the phone plan you are subscribed to
(none if you are not subscribed to any):

Solutions

Expert Solution

#include <iostream>
using namespace std;
//Declaring all the required functions
void Plan200(int min);
void Max20(int min);
void NoPlan(int min);
int main()
{
    int n,min;
    //Displaying the menu for the user
    cout<<"Select Your Plan\nPress 1 for Plan200\nPress 2 for Max20\nPress Any Other Key If You are not Subscribed to any Plan\n";
    //Taking choice Input
    cout<<"Enter Your Choice: ";
    cin>>n;
    //Taking Input of number of Minutes Spoken
    cout<<"Enter Number of Minutes Spoken: ";
    cin>>min;
    //If User Selects 1,Calling Plan200() Function
    if(n==1)
        Plan200(min);
    //IF USer Selects 2,Calling Max20() Function
    else if (n==2)
        Max20(min);
    //Other Than That,Calling NoPlan() Function
    else
        NoPlan(min);
}


//Function for Plan200 Plan
void Plan200(int min){
    //if min less than or equal to 200, charging is $20
    if(min<=200)
        cout<<"You Will Be charged $20 For the First 200 Minutes.";
    else{
        //Calculating total
        double total=20+((min-200)*0.1);
        //printing total
        cout<<"You Will be charged $"<<total;
    }
}


//Function for Max20 Plan
void Max20(int min){
    //Calculating total Bill
    double total=0.05*min;
    //if bill is less than or equal to $20, printing it
    if(total<=20)
        cout<<"You Will be charged $"<<total;
    //else printing $20 as bill
    else
        cout<<"You Will be Charged $20";
}


//Function for No Plan
void NoPlan(int min){
    //Calculating total
    double total=0.1*min;
    //printing the total
    cout<<"You will be charged $"<<total;
}


Related Solutions

IN C++ LANGUAGE PLEASE::: Design and implement a program (name it Rectangle) to calculate and display...
IN C++ LANGUAGE PLEASE::: Design and implement a program (name it Rectangle) to calculate and display the area and perimeter of a rectangle with width = 4 and height = 8.
Design and implement a Java program that creates a GUI that will allow a customer to...
Design and implement a Java program that creates a GUI that will allow a customer to order pizza and other items from a Pizza Paarlor. The customer should be able to order a variety of items which are listed below. The GUI should allow the customer (viaJavaFX UI Controls - text areas, buttons, checkbox, radio button, etc.) to input the following information: Name of the customer First Name Last Name Phone number of the customer Type of food being order...
Design and implement a C++ program that performs the following steps:Ask the user to enter a...
Design and implement a C++ program that performs the following steps:Ask the user to enter a positive integer number N; Your program may need to prompt the user to enter many times until it reads in a positive number;Let user to enter N (obtained in the previous step) floating point numbers, and count how many positive ones there are in the sequence and sum up these positive numbers; (Hint: negative numbers or 0 are ignored).Display result.You can and should use...
Design and implement a C++ program read in a whole line of characters as the input...
Design and implement a C++ program read in a whole line of characters as the input string; count and display how many times how frequently (among the letters) each (case insensitive) letter appears in the above mentioned input string; Sample program execution: An example of executing such a program is shown below. Note that the user input is in italic font. Please enter a line of characters: This is a really long line of characters! There are 41 characters in...
IN C++ PLEASE!!! Design and implement a program (name it Coins) that determines the values of...
IN C++ PLEASE!!! Design and implement a program (name it Coins) that determines the values of coins in a jar. The program prints out the total dollars and cents in the jar. The program prompts the user to enter the number of coins (quarters, dimes, nickels, and pennies). Print out the number of coins entered for each coin type on separate lines followed by the total amount of money in the jar as dollars and cents as shown below.
For this program you will implement the following utility functions to test mastery of C strings....
For this program you will implement the following utility functions to test mastery of C strings. *******you MUST use these these function***** void removeBlanks(char *src, char *dest); void replaceChar(char *src, char oldChar, char newChar); char *flipCase(const char *src); Please read the description of these functions carefully. In the removeBlanks function you will implement a routine that takes a string in as src and outputs the same string into dest but removing any blank space character encountered. For example, if the...
Problem: Write a C++ program that will implement and test the five functions described below that...
Problem: Write a C++ program that will implement and test the five functions described below that use pointers and dynamic memory allocation. The Functions: You will write the five functions described below. Then you will call them from the main function, to demonstrate their correctness. 1. minimum: takes an int array and the array's size as arguments. It should return the minimum value of the array elements. Do not use square brackets anywhere in the function, not even the parameter...
C++ Write a program that can be used to calculate the federal tax. The tax is...
C++ Write a program that can be used to calculate the federal tax. The tax is calculated as follows: for single people, the standard exemption is $4,000; for married people, the standard exemption is $7,000. A person can also put up to 6% of his or her gross income in a pension plan. the tax rates are as follows: if the taxable income is: Between $0 and $15,000, the tax rate is 15%. Between $15,001 and 40,000 the tax rate...
DO THIS IN C#. Design and implement a program (name it MinMaxAvg) that defines three methods...
DO THIS IN C#. Design and implement a program (name it MinMaxAvg) that defines three methods as follows: Method max (int x, int y, int z) returns the maximum value of three integer values. Method min (int X, int y, int z) returns the minimum value of three integer values. Method average (int x, int y, int z) returns the average of three integer values. In the main method, test all three methods with different input value read from the...
In C ++, Design and implement a program that reads from the user four integer values...
In C ++, Design and implement a program that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered:    95, 80, 100, 70 Highest grade: 100 Lowest grade:   70 Average grade: 86.25
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT