Photo AI

Write a VB.Net program that calculates an estimate of the braking distance in metres for a new model of go-kart that is travelling between 10 and 50 kilometres per hour (kph) - AQA - GCSE Computer Science - Question 18 - 2021 - Paper 1

Question icon

Question 18

Write-a-VB.Net-program-that-calculates-an-estimate-of-the-braking-distance-in-metres-for-a-new-model-of-go-kart-that-is-travelling-between-10-and-50-kilometres-per-hour-(kph)-AQA-GCSE Computer Science-Question 18-2021-Paper 1.png

Write a VB.Net program that calculates an estimate of the braking distance in metres for a new model of go-kart that is travelling between 10 and 50 kilometres per h... show full transcript

Worked Solution & Example Answer:Write a VB.Net program that calculates an estimate of the braking distance in metres for a new model of go-kart that is travelling between 10 and 50 kilometres per hour (kph) - AQA - GCSE Computer Science - Question 18 - 2021 - Paper 1

Step 1

keep asking the user to enter a speed for the go-kart until they enter a speed that is between 10 and 50 (inclusive)

96%

114 rated

Answer

Dim speed As Integer

Do
    speed = Console.ReadLine()
Loop While speed < 10 Or speed > 50

Step 2

calculate the braking distance in metres by dividing the speed by 5

99%

104 rated

Answer

Dim braking_distance As Decimal
braking_distance = speed / 5

Step 3

ask the user if the ground is wet (expect the user to enter yes if it is)

96%

101 rated

Answer

Dim IsWet As String
IsWet = Console.ReadLine()

Step 4

if the ground is wet, multiply the braking distance by 1.5

98%

120 rated

Answer

If IsWet = "yes" Then
    braking_distance = braking_distance * 1.5
End If

Step 5

output the final calculated braking distance

97%

117 rated

Answer

Console.WriteLine(braking_distance)

Join the GCSE students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;