ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions
8 marks · Input validation
Using a design technique of your choice, refine step 2 to ensure the user enters a valid number of hours. Using a design technique of your choice, refine step 6. State the part of the processor that will temporarily store the calculated total cost of a hire once the program is implemented. A program is being designed to allow customers to hire paddleboards. The algorithm for this program is shown below. 1. Initialise variables 2. Ask user for valid number of hours 3. Use number of hours to assign cost for one paddleboard 4. Ask user for number of paddleboards required 5. Ask user for the number of wetsuits required 6. Calculate totalHire 7. Display totalHire
• conditional loop for validation • correct loop condition (input is not equal to 1,2, 4) • input assigned inside the loop • error message inside the loop Candidates may write or describe the conditions a variety of ways. Where candidate does not use a loop, one mark may be awarded for the error message where attached conditions are correct. If the loop is missing the start/end of the loop assume that everything above or below the start/end is inside the loop. • number of paddle boards * cost of one paddle board • number of wetsuits * 5 • store sum of two calculations register(s)