Question: You have been assigned to write a software to convert between km per hour and meter per sec. The software should fulfill the following
You have been assigned to write a software to convert between km per hour and meter per sec. The software should fulfill the following criteria: i. Receive either m/sec or km/hour and leave 0 for the other. Exit program if both inputs are 0 and print out error message if the unit entered is not valid. ii. A function called kmh_to_msec() to convert km/hour value to m/sec and function called msec_to_lamh () to convert m/sec value to km/hour. Parameter for both functions used pass-by-reference technique. An example of the output is as illustrated in Figure Q3: OUTPUT CONSOLE Enter m/s or km/h and leave 0 for the other, both 0 to exit. Enter m/s:0 [enter] Enter km/h:14 [enter] 14 km/h = 3.89 m/s. Enter m/s or km/h and leave 0 for the other, both 0 to exit. Enter /s:100 [enter] Enter km/h:0 (enter] 100 m/= 360.00 km/h. Enter a/s or km/h and leave 0 for the other, both to exit. Enter m/s:1 [enter] Enter km/h:1 [enter] Please enter either km/h or m/s. Enter m/s or km/h and leave 0 for the other, hath 0 to exit. Enter m/s:0 [enter] Enter km/h:0 (enter] ... Program finished with exit code 0 Figure Q3: Output sample Based on the following requirement, you must: (a) Identify input variable(s) and output variable(s) for this problem. [CI, SP1] (b) Draw the flowchart for the program. [C2, SP4] (c) Write the complete program. [C3, SP4] [2 marks] [9 marks] [14 marks]
Step by Step Solution
3.41 Rating (164 Votes )
There are 3 Steps involved in it
Q a The input variables are the entered value which is kmperhour and meterpersec and the ... View full answer
Get step-by-step solutions from verified subject matter experts
