program ideone ; VAR count1 : integer ; count2 : integer ; count3 : integer ; count4 : integer ; count5 : integer ; string1 : array [ 0 .. 75 ] of char ; amt1 : array [ 0 .. 15 ] of integer ; amt2 : array [ 0 .. 15 ] of integer ; amt3 : array [ 0 .. 15 ] of integer ; amt4 : array [ 0 .. 15 ] of integer ; amt5 : array [ 0 .. 15 ] of integer ; sum_1 : integer ; sum_2 : integer ; sum_3 : integer ; sum_4 : integer ; sum_5 : integer ; mas_name : char ; c_cost : real ; section1 : char ; section2 : char ; section3 : char ; section4 : char ; section5 : char ; amt_paid : integer ; section_counter : array [ 0 .. 4 ] of integer ; section_pay : array [ 0 .. 4 ] of integer ; total_paid : integer ; exit_flag : boolean ; exit_input : string ; i : integer ; BEGIN // This initializes the exit flag, ensuring that we enter the main loop. exit_flag : = true ; // This initializes our counters and amount paid for each section. for i : = 0 to 4 do begin section_counter [ i ] : = 0 ; section_pay [ i ] : = 0 ; end ; // This initializes our total paid. total_paid : = 0 ; // Welcome message. Writeln ( '****WELCOME TO THE COMMAZ BAND EXCLUSIVE CARNIVAL. FOLLOW THE INSTRUCTIONS THAT ARE GIVEN.****' ) ; // We enter the loop here. while ( exit_flag ) do begin Writeln ( 'Enter the Masqueraders name: ' ) ; readln ( string1 ) ; Writeln ( 'Enter the cost of the costume: ' ) ; readln ( c_cost ) ; Writeln ( 'Enter the Amount Paid by the Masquerader: ' ) ; readln ( amt_paid ) ; // Section 1. if ( ( amt_paid = 144 ) or ( amt_paid = 184 ) ) then begin // Section 1. Writeln ( 'THIS MASQUERADER IS IN SECTION: Section 1' ) ; Inc ( section_counter [ 0 ] ) ; section_pay [ 0 ] += amt_paid ; total_paid += amt_paid ; end else if ( ( amt_paid = 198 ) or ( amt_paid = 253 ) ) then begin // Section 2. Writeln ( 'THIS MASQUERADER IS IN SECTION: Section 2' ) ; Inc ( section_counter [ 1 ] ) ; section_pay [ 1 ] += amt_paid ; total_paid += amt_paid ; end else if ( ( amt_paid = 252 ) or ( amt_paid = 322 ) ) then begin // Section 3. Writeln ( 'THIS MASQUERADER IS IN SECTION: Section 3' ) ; Inc ( section_counter [ 2 ] ) ; section_pay [ 2 ] += amt_paid ; total_paid += amt_paid ; end else if ( ( amt_paid = 315 ) or ( amt_paid = 405 ) ) then begin // Section 4. Writeln ( 'THIS MASQUERADER IS IN SECTION: Section 4' ) ; Inc ( section_counter [ 3 ] ) ; section_pay [ 3 ] += amt_paid ; total_paid += amt_paid ; end else if ( ( amt_paid = 383 ) or ( amt_paid = 489 ) ) then begin // Section 5. Writeln ( 'THIS MASQUERADER IS IN SECTION: Section 4' ) ; Inc ( section_counter [ 4 ] ) ; section_pay [ 4 ] += amt_paid ; total_paid += amt_paid ; end ; // Now that we've finished one run-through of the program, we ask if // we want to do this again. Writeln ( 'Do you want to add another masquerader? Input Yes to do so.' ) ; readln ( exit_input ) ; if ( ( exit_input <> 'yes' ) and ( exit_input <> 'YES' ) and ( exit_input <> 'Yes' ) ) then begin exit_flag : = false ; end ; end ; // Now that we're out of the loop, we print everything. Writeln ( 'Totals for each section:' ) ; for i : = 0 to 4 do begin write ( 'Section ' , i + 1 , '

' ) ; write ( 'Number of masqueraders: ' , section_counter [ i ] , '

' ) ; write ( 'Amount paid: ' , section_pay [ i ] , '

' ) ; Writeln ( ) ; end ; write ( 'Total paid: ' , total_paid , '

' ) END .

cHJvZ3JhbSBpZGVvbmU7ClZBUgpjb3VudDE6aW50ZWdlcjsKY291bnQyOmludGVnZXI7CmNvdW50MzppbnRlZ2VyOwpjb3VudDQ6aW50ZWdlcjsKY291bnQ1OmludGVnZXI7CnN0cmluZzE6YXJyYXlbMC4uNzVdb2YgY2hhcjsKYW10MTphcnJheVswLi4xNV1vZiBpbnRlZ2VyOwphbXQyOmFycmF5WzAuLjE1XW9mIGludGVnZXI7CmFtdDM6YXJyYXlbMC4uMTVdb2YgaW50ZWdlcjsKYW10NDphcnJheVswLi4xNV1vZiBpbnRlZ2VyOwphbXQ1OmFycmF5WzAuLjE1XW9mIGludGVn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