Answer to Question #241712 in C++ for Kireut

Question #241712

Write a C++ program that calculates the due amount for a cellular telephone bill. The cell company offers the following two types of services:

  • LOW: $0.2 per day minute for the first 100 minutes, plus $0.5 per each extra day minute. And all-night minutes are free.
  • HIGH: $0.1 for the first 200 day minutes, plus $0.2 per each extra day minute. The charge is free for the first 200 night minutes, plus $0.1 per each extra night minute.

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.


1
Expert's answer
2021-09-24T18:56:51-0400


#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS