Write a program to calculate mobile phone charges according to the following packages. 1. One Hour Package (Package A): If the customer talks for one hour (60 minutes) then Rs. 10 will be charged for one hour (60 minutes) and Rs. 2 will be charged for every extra minute after 60 minutes. 2. 20 Minutes Package (Package B): Rs. 1 will be charged for the first 20 minutes and for every extra minute Rs. 2.5 will be charged. 3. No Package (Package N): Rs. 2 per minute will be charged.
#include <iostream>
#include<math.h>
using namespace std;
//The start point of the program
int main(){
int minutes;
double charges;
int choice;
cout<<"1. Package A\n";
cout<<"2. Package B\n";
cout<<"3. Package N\n";
cout<<"Your choice: ";
cin>>choice;
if(choice>=1 && choice<=3){
cout<<"Ente the number of minutes: ";
cin>>minutes;
if(choice==1){
if(minutes<=60){
charges =60*10;
}else{
charges=60*10+(minutes-60)*2;
}
}
if(choice==2){
if(minutes<=20){
charges =20;
}else{
charges=20+(minutes-20)*2.5;
}
}
if(choice==3){
charges=minutes*2.0;
}
}else{
cout<<"Wrong package!\n\n";
}
cout<<"Charges: Rs. "<<charges<<"\n\n";
system("pause");
return 0;
}
Comments
Leave a comment