A C# program calculates the daily rental rate of a scooter based on the state code and rental duration.
1 int rate = 0;
2 Console.Write("Enter driver license state code: ");
3 string stateCode = Console.ReadLine();
4 while (stateCode.Length != 2) {
5 string promptMessage = "Must be 2 letters: ";
6 Console.Write(promptMessage);
7 stateCode = Console.ReadLine();
8 }
9 Console.Write("Enter rental duration in hours: ");
10 int hours = Convert.ToInt32(Console.ReadLine());
11 if (hours < 3) {
12 rate = 12;
13 }
14 else {
15 rate = hours * 4;
16 }
17 Console.WriteLine(rate);
The rate for rentals lasting three or more hours is changed to include an additional £5 safety insurance surcharge.
Rewrite line 15 to show this change.
Your answer must be written in C#.
Practise AQA GCSE Computer Science Arithmetic operations in a programming language with exam-style questions for GCSE Computer Science. 7 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.