Question
April 14, 2010 at 03:19 PM
damomugato

c can any one do it 4 me

by damomugato . Updated 16 years, 4 months ago

Write a program will simulate the operation of a phonebox
The program should first request the user to enter coins. Valid coins are lOc, 20c and 50c. All other values should be ignored. The program should continue to request coins until the user enters 0.
The program should then request a call type from the user. Valid Call Types are L (local), T (trunk), I (international). The program should continue to request a valid call type until one is entered.
From a phonebox a caller gets: LOCAL CALLS:30 seconds for every 10 cent.
TRUNK CALLS: 15 seconds for every 10 cent.
INTERNATIONAL CALLS 5 seconds for every 10 cent.

When a valid call type is entered, the program should calculate and display the amount of time the user has.
Finally, rewrite the program using at least one of the following user-defined functions:
int get_coins (void); This function continues to ask for coins until the user types 0.
char getjype (void); This function continues to ask for a call type until a valid type is entered.
void display_time (int coins, char type); This function takes as input the total coins entered, and the call type. It calculates the call-time allowed and displays it on the screen.

This discussion is locked

All Comments