In: Computer Science
A mobile phone service provider has three different subscription packages for its customers:
Package A: For $39.99 per month 450 minutes are
provided. Additional minutes are
$0.45 per minute.
Package B: For $59.99 per month 900 minutes are
provided. Additional minutes are
$0.40 per minute.
Package C: For $69.99 per month unlimited minutes provided.
Write a program that calculates a customer’s monthly bill. It
should ask which package
the customer has purchased and how many minutes were used. It
should then display
the total amount due.
Input Validation: Be sure the user only selects package A, B, or C.
Assume 30 day month(Billing Cycle). Maximum Minutes is 43200.
Quality of craftsmanship is part of the grading.
===============================================================================
#include <iostream>
using namespace std;
int main() {
float mins=0,bill=0;
char package;
while(1){
//reading package
cout<<"Enter your package: ";
cin>>package;
//checking if it is valid package
if(package=='A' || package=='a'||package=='b' || package=='B' ||package=='c' || package=='C')
break;
//error message
cout<<"Invalid input..try again\n";
}
//reading mins
cout<<"Enter number of mins : ";
cin>>mins;
//checking if package is A
if(package=='A' || package=='a'){
bill=39.99;
if(mins>450)
bill=bill+(mins-450)*0.45;
}
if(package=='B' || package=='b'){
bill=59.99;
if(mins>900)
bill=bill+(mins-900)*0.40;
}
if(package=='C' || package=='c'){
bill=69.99;
}
cout<<"Total Bill : $"<<bill;
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me