I've been struggling with this and can't seem to figure it out. I'm supposed to use a flag controlled loop and as you can tell from reading the code I have no clue what I'm doing.
An Internet service provider has three different subscription
packages for its customers:
Package A: For $15 per month with 50 hours of access provided.
Additional hours are $2.00 per hour over 50 hours.
Assume usage is recorded in one-hour increments,
Package B: For $20 per month with 100 hours of access provided.
Additional hours are $1.50 per hour over 100 hours.
Package C: For $25 per month with 150 hours access is provided.
Additional hours are $1.00 per hour over 150 hours
Assume a 30-day billing cycle.
Write a program that calculates a customer’s monthly charges.
Use if/else construct for validation & Validate all input.
Show console dialog. It must be readable.
Demonstrate test cases as described in table:
Test Case Package Hours
1 A 50
2 a 51
3 B 100
4 b 101
5 C 149
6 c 151
7 C 721
8 d 720
*/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
void main()
{
cout << "Thank you for choosing Marky's Internet Service Provider!" << endl;
cout << "Please enter a package choice(A,B, or C): " << endl;
char package_choice(0);
cin >> package_choice;
if(package_choice == 'A' || package_choice == 'a')
{
cout << "You have selected package choice A!" << endl;
cout << "Please input the amount of hours of usage: " << endl;
bool flag = false;
int usage_hrs(0);
cin >> usage_hrs;
if(usage_hrs <= 0 && usage_hrs >= 720)
cout << "Invalid amount of hours." << endl;
cout << "You have input " << usage_hrs << " hours." << endl;
if(usage_hrs >= 0 && usage_hrs <= 50)
usage_hrs = 15;
cout << "Your monthly bill is: $" << usage_hrs << endl;
while(!flag)
{
|