View Single Post
Old 03-03-2005, 05:57 AM   #1 (permalink)
Aznxmel
Registered User
 
Join Date: Mar 2005
Posts: 3
Aznxmel is on a distinguished road
Unhappy Bill Calculation

Im a newbie as everyone knows. and im stressing this project. here it is

i know i have to use if and else statements with this problem

It is a cell phone bill calculation:

I'm soppouse to write a progam that calculates a bill. there are two types of services Regular and Premium. The program needs a service code(type char) a service code of P means Premium service and R for Regular service.

Regular services: $10.00 plus first 50 minutes are free. Charges for over 50 minutes are $0.20 per minute.
Premium service: $25.00 plus:
a. For calls made from 6:00 a.m. to 6:00 p.m., the first 75 minutes are free; charges for over 75 minutes are $0.10 per minutes
b. For calls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes are free; charges for over 100 minutes are $0.05 per minute.
Your program should prompt the user to enter an account number, a service code (type char), and the number of minutes the service was used. A service code of r or R means regular service; a service code of p or P means premium service. Treat any other character as an error. Your program should output the account number, type of service, number of minutes the telephone service was used. And the amount due from the user.
For the premium service, the customer may be using the service during the day and the night. Therefore, to calculate the bill, you must ask the user to input the number of minutes the service was used during the day and the number of minutes the service was used during the night.


so i typed

double accountNumber (0.0);
double numberOfMinutes (0.0);
char service code

how do i add the P and R to the code to recognize it is a sercice code.

it alsy says that the premiumservice, the customer may be using the service code

now the if and else staments i typed for Regular

if (X < 50): $10.00
else .20 per minute;

Now for Preium:

i dont know how to write this one since its dealing with time as well. Does anyone know how to do this. Please let me know
Aznxmel is offline   Reply With Quote