Question: Please write the coding clearly.I need to understand how to solve this question. 12 CS/MAR 2013/CSC125/128/1TC120 CONFIDENTIAL QUESTION 2 The following table shows the average

 Please write the coding clearly.I need to understand how to solve

Please write the coding clearly.I need to understand how to solve this question.

12 CS/MAR 2013/CSC125/128/1TC120 CONFIDENTIAL QUESTION 2 The following table shows the average speed per hour for two types of vehicles Vehicle Average Speed Code 120 km/h 2 75 km/h a) Write the definition of a function named CalcDistance ) that receives the vehicle code and time travelled in minutes. The function will calculate and return the distance travelled in kilometer for that type of vehicle. The formula to calculate the distance travelled is as follows. Distance Travelled (km) = Average Speed . (Time traveled/60) (4 marks) b) Write the definition of a function named CalcFuelConsumption) that receives the distance travelled in kilometer and fuel usage in liter. The function will calculate and return the fuel consumption in liter per kilometer that has been used by that particular type of vehicle. The formula to calculate the fuel consumption is as follows: Fuel Consumption (liter/km) Fuel Usage/ Distance Travelled (4 marks) c) Write a main program that requires the user to enter the vehicle code, time travelled in minutes and fuel usage in liter. The program will call all of the functions above to calculate the distance travelled in kilometer and the fuel consumption in liter per kilometer used by the vehicle. Later, the program will print all of the information of the vehicle as shown in the example below Vehicle Code Time travelled Distance travelled Fuel usage Fuel consumption 120 minutes 240 km 50 liter 0.208333 liter/km (7 marks) END OF QUESTION PAPER

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!