8.The New \'Telephone Company has the following rate structure for long- distanc
ID: 3639790 • Letter: 8
Question
8.The New 'Telephone Company has the following rate structure for long-distance calls:
•The regular rate for a call is $0.10 per minute.
•Any call started at or after 6:00 P.M. (1800 hours) but before 8:00 A.M.
(0800 hours) is discounted 50 percent.
•Any call longer than 60 minutes receives a 15 percent discount on . its
cost (after any other discount is subtracted).
•All calls are subject to a 4 percent federal tax on their final cost.
Write a program that reads the start time for a call based on a 24-hour
clock and the length of the call. The gross cost (before any discounts or
tax) should be printed, followed by the net cost (after discounts are
deducted and tax is added). Use separate functions to print instructions
to the program user and to compute the net cost.
Explanation / Answer
PS: Please rate the answer. We spend effort in helping you.
#include <iostream>
using namespace std;
float NetCost(int,int,float);
const float rate = .10;
const float FEDERAL_TAX= .04;
const float TIME_DISCOUNT = .5;
const float DURATION_DISCOUNT = .15;
int main()
{
int starttime;
int minutes;
float grosscost;
cout<<"What was the start time for your call in military time between 0000 to 2400: "<<endl;
cin>>starttime;
cout<<"How long did the call last in minutes: "<<endl;
cin>> minutes;
grosscost= minutes * rate;
cout<<"The gross cost for the call is "<<grosscost;
cout<<"The net cost for the call is "<< NetCost(starttime, minutes, grosscost);
return 0;
}
float NetCost(int starttime, int minutes, float grosscost)
{
float netCost = grosscost;
float discount = 0.0;
if((starttime >= 1800) || (starttime <= 800))
{
discount = netCost * TIME_DISCOUNT;
netCost = netCost - discount;
}
if(minutes > 60 )
{
discount = netCost * DURATION_DISCOUNT;
netCost = netCost - discount;
}
return (netCost*(1+FEDERAL_TAX));
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.