ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions
16 marks · Development process and analysis
Describe two processes for the flight booking app. Process 1 Process 2 The design below shows how the total cost of a booking is calculated. Algorithm 1. Find ticket costs 2. Get quantity of passengers 3. Calculate initial cost of booking 4. Update cost of booking if bag(s) are added 5. Display final cost of booking Refinements 2.1 Get quantity of adult passengers 2.2 Get quantity of child passengers The app provides an option to add bags to the booking. Each passenger is asked if they want to add a bag. The cost is an additional £7 for each passenger who decides to take a bag. Using a design technique of your choice, refine step 4. Passengers are allocated an available seat. A data structure named seats is used to store whether each seat is available (true) or unavailable (false). Available Unavailable 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Seat allocation State the most suitable data structure and data type used to store the seat availability. Data structure Data type The following pseudocode design shows how an available seat is allocated. 1 generate a random seat number 2 loop while the generated seat is unavailable 3 generate another random seat number 4 end loop 5 change seat to unavailable Using a programming language of your choice, write the code required to implement the above design. Explain why the above design becomes less efficient as more passengers are allocated seats. The app will store passenger information. State how this information could be transferred securely from the app to the computers running the booking system. In a flight booking app, users are asked to enter their departure airport, destination airport, departure date, return date, number of adults and number of children. A message will then be displayed showing the total flight cost and the duration of the trip.
One mark each for any two descriptions of • calculate total (flight) cost • calculate duration of trip • validation of inputs Allow additional correct processes that candidates may interpret from the given problem, for example “find flights”, “calculate duration of flight”. One mark each for • loop for correct number of passengers • input statement referring to bags • if statement with correct condition • running total within loop • total cost calculated (bag cost + booking cost) Running total and total cost could be implement in one step. Number of loop iterations and variable used may vary according to language, for example: 0 to passengers, 1 to passengers. Three possible solutions are shown below. Note that there may be others. Loop for each passenger Ask if passenger wants a bag If answer = yes Add £7 onto total End if End loop Loop for each passenger Ask if passenger wants a bag If answer = yes Add 1 onto bag number End if End loop Total = total + bag number * 7 Loop for each passenger Ask if passenger wants a bag If answer = yes Add £7 onto bag total End if End loop Total = total + bag total One mark each for • array • Boolean One mark each for • before loop, store a random number with appropriate range (60 seats) • while loop with condition: data structure ‘seats’ with random number index = false • store a random number (60 seats) again inside loop • after loop, data structure ‘seats’ with random number index = false Accept programming language specific versions of random. If the random value is simply displayed do not award bullet points 1 and 3. One mark each for • a number/seat generated is more likely to be allocated already • demonstrating an understanding that the above will cause the program to repeat/loop again Accept reverse of first bullet: • a number generated is less likely to be available encrypted Accept alternative secure methods of transfer with indication why it is secure.