A telephone company is charging the customers each month with a service fee as the following:
1 hour of calls = 45 Riyal
1 message = 40 Halala
Suppose the company has a customer with 287 minute calls and 23 messages. Write a program that calculates and prints the following:
The amount charges for calls.
The amount charges for messages.
The total amount the customer charges.
[Sample Run] 215.25 9.2 224.45 . . . . . . . .
#include <iostream>
using namespace std;
int main() {
cout << "Enter call minutes: ";
int minutes;
cin >> minutes;
cout << "Enter messages: ";
int messages;
cin >> messages;
double callCharge = 45.0 * minutes / 60;
double messageCharge = 0.4 * messages;
cout << callCharge << " " << messageCharge << " " << callCharge + messageCharge << endl;
return 0;
}
Comments
Leave a comment