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#.
7 exam-style questions on AQA GCSE Computer Science Arithmetic operations in a programming language. Each one has a worked solution and a mark scheme showing where the marks go.