Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is the question: Write a program that will calculate your monthly fee for i

ID: 3546276 • Letter: H

Question



Here is the question:


Write a program that will calculate your monthly fee for internet.  There are 3 different prices for different speeds.

Package 1: $19.90 per month, fastest speed

Package 2: 14.90 per month

Package 3: $9.90 per month, slowest speed


Ask user to enter a choice first; choice can be 1, 2, 3, or 4 as quit.  Then ask user to enter a number of a month, and display their total charge (month*monthly fee).  Keep displaying the menu and asking user to enter a number of month, until a user enters a 4 for choice.


FUNCTIONS

You must have the following funtions:

1.  Display menu: this is a void function, displays the 3 different packages for user to choose.  Choice 4 is quit.

2.  getChoice(). Should ask the user for a choice, make sure the choice is between 1 and 4.  The choice value should be returned to the function call.

3.  getMonth().  Should ask the user for a number of month, make sure the month user has entered is between 1 and 12.  The month value should be returned to the function call.

4.  calculateTotal.  This function should have input parameters (month an monthly fee), and calculate the total based on month and monthly fee, ask user to ake a choice again, and return the total value to the function call.

5.  Display.  This function should be a void function and take the value of total fee as input parameter, and display the total.

6.  isTooMuch.  This function should be a Boolean function, it should take the value of the total fee as input parameter.  If the total fee is more than 100, you need to return the value, otherwise return a false value.


In your main function, you need to use a do-while loop to keep ask user a choice and make corresponding calculations.  If the isTooMuch function returned a true value, you want to output a message: "you are paying too much, would you like to consider a cheaper package?"



Sample output

                                                                    

                                                  Your total internet Charge

                          1.     Package 1: $19.90 per month, fastest speed.

                          2.     Package 2: $14.90 per month.

                          3.     Package 3: $9.90 per month, slowest speed.

                          4.     Quit

                          Please enter :

                          1 [enter]

                          Please enter the number of the month:

                          2 [enter]

                          You have selected Package 1, Your total charge is 119.4

                          You are paying too much, would you like to consider a cheaper package?



Explanation / Answer

please rate - thanks


any questions ask



#include <iostream>
using namespace std;
void DisplayMenu();
int getChoice();
int getMonth();
double calculateTotal(int, double);
void Display(int, double);
bool isTooMuch(double);

int main()
{int choice,month;
double fee,cost;
DisplayMenu();
choice=getChoice();
do
{if(choice==1)
     cost=19.9;
else if(choice==2)
     cost=14.9;
else
     cost=9.9;
month=getMonth();
fee=calculateTotal(month,cost);
Display(choice,fee);
if(isTooMuch(fee))
    cout<<"You are paying too much, would you like to consider a cheaper package? ";
cout<<endl;
DisplayMenu();
choice=getChoice();
}while(choice!=4);
    return 0;
}
void DisplayMenu()
{cout<<"Your total internet Charge ";
cout<<"1. Package 1: $19.90 per month, fastest speed. ";
cout<<"2. Package 2: $14.90 per month. ";
cout<<"3. Package 3: $9.90 per month, slowest speed. ";
cout<<"4. Quit ";
}
int getChoice()
{int n;
cout<<"Please enter: ";
cin>>n;
while(n<1||n>4)
    {cout<<"Invalid entry ";
    cout<<"Please enter: ";
     cin>>n;
     }
return n;
}
int getMonth()
{int n;
cout<<"Please enter the number of the month: ";
cin>>n;
while(n<1||n>12)
    {cout<<"Invalid entry ";
    cout<<"Please enter: ";
     cin>>n;
     }
return n;
}
double calculateTotal(int months, double fee)
{return months*fee;
       }
void Display(int choice, double fee)
{cout<<"You have selected Package "<<choice<<", Your total charge is "<<fee<<endl;
     }
bool isTooMuch(double fee)
{if(fee>100)
     return true;
else
     return false;
}