In: Computer Science
Long-Distance Calls A long-distance provider charges the following rates for telephone calls: Rate Category Daytime (6:00 A.M. through 5:59 P.M.) Evening (6:00 P.M. through 11:59 P.M.) Off-Peak (12:00 A.M. through 5:59 A.M.) Rate per Minute $0.07 $0.12 $0.05 Create a C++ program that allows the user to select a rate category and enter the number of minutes of the call, then displays the charges.
Use the following test data to determine if the application is calculating properly:
Rate Category and Minutes Charge
Daytime, 20 minutes $ 1.40
Evening, 20 minutes $ 2.40
Off-peak, 20 minutes $ 1.00
#include<iostream>
using namespace std;
int main(){
string category;
int minutes;
cout<<"Enter a
category(Daytime/Evening/Off-peak): ";
cin>>category;
cout<<"Enter minutes of call: ";
cin>>minutes;
if(category=="Daytime"){
cout<<"Charge:
$"<<1.0*minutes*.07;
}
if(category=="Evening"){
cout<<"Charge:
$"<<1.0*minutes*.12;
}
if(category=="Off-peak"){
cout<<"Charge:
$"<<1.0*minutes*.05;
}
return 0;
}