Question 3
AQA Computer Science June 2022 Paper 1C (8525/1C)GCSE2 marks
On the specification
- 3.1
- 3.2 Programming
- 3.2
- 3.2 Programming
Question text
3 Figure 4 shows a VB.Net program that calculates car park charges. box The user inputs their car registration (eg MA19 GHJ) and the length of the stay. The program then outputs the charge. • Line numbers are included but are not part of the program. Figure 4 1 Dim charge As Integer = 0 2 Console.Write("Enter your car registration: ") 3 Dim carReg As String = Console.ReadLine() 4 While carReg.Length() > 8 5 Dim displayMessage As String = " is not valid" 6 Console.WriteLine(displayMessage) 7 carReg = Console.ReadLine() 8 End While 9 Console.Write("Enter your stay in hours: ") 10 Dim hours As Integer = Console.ReadLine() 11 If hours < 2 Then 12 charge = 0 13 Else 14 charge = hours * 2 15 End If 16 Console.WriteLine(charge) 3.1 Rewrite line 5 in Figure 4 to concatenate the car registration with the string " is not valid", and store the result in the variable displayMessage. Your answer must be written in VB.Net. [1 mark] 3.2 The charge for parking for two or more hours is changed to include an additional £2 fee. Rewrite line 14 in Figure 4 to show this change. Your answer must be written in VB.Net. [1 mark]