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 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 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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
If IsWet = "yes" Then
braking_distance = braking_distance * 1.5
End If
Step 5
output the final calculated braking distance.
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!