Write a C++ program that calculates the due amount for a cellular telephone bill. The cell company offers the following two types of services:
The program should ask the user for the type of service (Input the word LOW or HIGH) that he uses and the amount of day minutes and night minutes he consumed and then the program will print the service type (the word LOW or the word HIGH), total number of minutes, and the total amount due.
#include <iostream>
using namespace std;
int main()
{
cout<<"1. LOW\n2.HIGH\nChoose type of service: ";
int c;
cin>>c;
int day_minutes,night_minutes;
cout<<"\nEnter day minutes:";
cin>>day_minutes;
cout<<"\nEnter night minutes:";
cin>>night_minutes;
if (c==1){
int total;
if(day_minutes>100){
int n=day_minutes-100;
total=(0.2*100)+(n*0.5);
}
else{
total=(0.2*day_minutes);
}
cout<<"\nType of service: LOW";
cout<<"\nTotal minutes: "<<(day_minutes+night_minutes);
cout<<"\nTotal amount due: "<<(total);
}
else if(c==2){
int total;
if(day_minutes>200){
int n=day_minutes-200;
total=(0.1*200)+(n*0.2);
}
else{
total=(0.1*day_minutes);
}
if (night_minutes>200){
int n=night_minutes-200;
total=total+(n*0.1);
}
cout<<"\nType of service: LOW";
cout<<"\nTotal minutes: "<<(day_minutes+night_minutes);
cout<<"\nTotal amount due: "<<(total);
}
return 0;
}
Comments
Leave a comment