Photo AI

Distance of mountain pass in miles 145.87 Question 1.1 Write code to convert the distance entered into kilometres - NSC Information Technology - Question 1 - 2016 - Paper 1

Question icon

Question 1

Distance-of-mountain-pass-in-miles-145.87--Question-1.1--Write-code-to-convert-the-distance-entered-into-kilometres-NSC Information Technology-Question 1-2016-Paper 1.png

Distance of mountain pass in miles 145.87 Question 1.1 Write code to convert the distance entered into kilometres. Display the converted value and unit (km) in the... show full transcript

Worked Solution & Example Answer:Distance of mountain pass in miles 145.87 Question 1.1 Write code to convert the distance entered into kilometres - NSC Information Technology - Question 1 - 2016 - Paper 1

Step 1

Extract the distance from the text box as an integer

96%

114 rated

Answer

Use the input from the text box to get the distance in miles, converting it from a string to an integer format.

Step 2

Calculate the distance in kilometers

99%

104 rated

Answer

Use the formula:

Distance=Miles×1.6Distance = Miles \times 1.6

This conversion factor will turn miles into kilometers.

Step 3

Display the distance in the output window

96%

101 rated

Answer

Output the calculated distance value along with the label 'km' for clarity, ensuring it’s formatted correctly in the output display.

Join the NSC students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;