This is a question from the 2004 HSC paper though i a little confused so to clarify can someone do this question and post ur answer
I have my answers but I am confused i can spot more than 2 errors with that algorithm..is it just me...???HSC 2004 SDD said:An amateur theatre company wants to computerise the allocation and sale of seatsat its performances. The theatre company would like to have a system that identifiesand prints out a list of all unsold seats when a customer makes a purchase enquiry.
The theatre used by the company can seat 80 people. The theatre has eight rows,
each with 10 seats, as shown in the diagram below.
The following algorithm has been designed to print a list of all unsold seats.
1 BEGIN print_all_unsold_seats
2 seat = 1
3 row = 1
4 available = false
5 WHILE row <= 8
6 WHILE seat <= 10
7 IF array(row, seat) = “unsold” THEN
8 available = true
9 ENDIF
10 increment seat
11 ENDWHILE
12 increment row
13 ENDWHILE
14 IF available = true THEN
15 print array(row, seat)
16 ENDIF
17 END print_all_unsold_seats
(i) A deskcheck is conducted on the algorithm. It is found that it does not
operate as expected. Identify where two logic errors occur and, for each
error, write the corrected line(s) of code.
(ii) After meeting with members of the theatre company it is decided that
the algorithm needs to be able to print out a list of adjoining seats for
any customer who enquires about purchasing two or more seats in the
same row.
Develop an algorithm, using either pseudocode or a flowchart, which
would meet this specification.