Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

EE1005: Practical Test

After gaining excellent C coding skills in EE1005, you want to make a


program to calculate the travel cost and time for people using MRT. The
fare structure is given in the table on the right.
Average MRT Speed : 30km/h
Average waiting : 5 mins
The table only lists 0-3.2 then 3.3-4.2. How is 3.22 or 3.25? We will take its round
number to the first decimal point for calculation.
The program will:
1. Ask the client to enter the travel distance in km and the type of fare (Adult, Senior
Citizen / PWD, or Student).
2. Create functions to calculate MRTFare and MRTTime.
3. Give outputs to clients:
Your trip by MRT takes YZ minutes, AB seconds and costs $cd.ef
4. For client’s future plan, Please print a table for client’s information as follows:
Travel Distance Travel Time Fare
(km) (mins) | ($)
5 yy.yy | xx.xx
10 yy.yy | xx.xx
15 yy.yy | xx.xx
… … | …
45 yy.yy | xx.xx
(print all from 5 to 45 km)
5. Ask user to input the starting time (example 22:32:05), then display the arrival time.
It’s Singapore, so distance should be limited to 60km. Calculation is round up to
second only. Assume that MRT runs 24/7

If you only cannot calculate the MRT fare, please go ahead to calculate the time. Just make the
flat-fare of $2.50 for all trips and finish the exam. At least you will get the mark for time
calculation and displaying information table in question 4 and question 5.

If you cannot calculate the MRT fare for Adults, you can just simply calculate for Senior Citizen /
PWD and Students. Make Adult fare as flat rate of $2.50 and finish the code. You can always
come back to calculate Adult fare later if you have time.

If you are working on a question (say #4) and time is up, your whole program won’t run
because of unfinished syntax. So:

a. PLEASE put the comment signals such as /* */ or // for the unfinished


parts so that your program still run for other sections. We will mark these
unfinished parts as well. So do not erase them to make your program
running.
b. You will have extra 1 minute to finish this “comment job”.
Criteria for marking the code
1. The program must compile and run smoothly.
Serious penalty if it cannot compile.
2. The program run correctly
3. Use data type correctly
4. User friendly
5. Teammate friendly
6. Good algorithm/strategy

You might also like