A C# program calculates shipping fees based on package weight and track code length.
1 int charge = 0;
2 Console.Write("Enter your tracking code: ");
3 string trackCode = Console.ReadLine();
4 while (trackCode.Length < 6) {
5 string displayMessage = "is too short";
6 Console.Write(displayMessage);
7 trackCode = Console.ReadLine();
8 }
9 Console.Write("Enter package weight in kg: ");
10 int weight = Convert.ToInt32(Console.ReadLine());
11 if (weight < 5) {
12 charge = 3;
13 }
14 else {
15 charge = weight * 3;
16 }
17 Console.WriteLine(charge);
Figure 1
The charge for shipping packages weighing five or more kilograms is changed to include an additional £4 handling fee.
Rewrite line 15 in Figure 1 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.