Photo AI

Write a VB.Net program that allows a taxi company to calculate how much a taxi fare should be - AQA - GCSE Computer Science - Question 5 - 2021 - Paper 1

Question icon

Question 5

Write-a-VB.Net-program-that-allows-a-taxi-company-to-calculate-how-much-a-taxi-fare-should-be-AQA-GCSE Computer Science-Question 5-2021-Paper 1.png

Write a VB.Net program that allows a taxi company to calculate how much a taxi fare should be. The program should: - allow the user to enter the journey distance i... show full transcript

Worked Solution & Example Answer:Write a VB.Net program that allows a taxi company to calculate how much a taxi fare should be - AQA - GCSE Computer Science - Question 5 - 2021 - Paper 1

Step 1

Allow the user to enter the journey distance in kilometres

96%

114 rated

Answer

Dim distance As Double
Console.WriteLine("Enter the journey distance in kilometres:")
distance = Convert.ToDouble(Console.ReadLine())

Step 2

Allow the user to enter the number of passengers

99%

104 rated

Answer

Dim passengers As Integer
Console.WriteLine("Enter the number of passengers:")
passengers = Convert.ToInt32(Console.ReadLine())

Step 3

Calculate the taxi fare by charging £2 for every passenger

96%

101 rated

Answer

Dim fare As Double
fare = 2 * passengers

Step 4

Charging a further £1.50 for each kilometre

98%

120 rated

Answer

fare += 1.5 * distance

Step 5

Output the final taxi fare

97%

117 rated

Answer

Console.WriteLine("The final taxi fare is: £" & fare)

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

;