# Solved Exercises for Chapter 1 and 2 of Programming

4 Pages632 Words353 Views
Chapter 1Exercise 6:Steps:1.Int flag = 0;2.Char customer[100];3.Int custOweAmt[100];4.ask for total number of customers into nCust5.for I = 1 to n ( loop will continue for n customer)6.print: “enter name of customer”7.take input for customer name into customer[i-1] 8.do loop begins9.flag= 0;10.print: “enter number of tickets less than or equal to 4”11.take input for number of tickets12.check number of tickets if greater than 4 then go to step 13 otherwise step 1513.print: “You can purchase up to 4 tickets only.” 14.set flag = 1;15.else 16.custOweAmt[i-1] = 4 * 35;17.end if18.while ( flag) [ if flag = 1 then go to step 5 else go to step 3]19.end of loop20.for I = 1 to n ( loop will continue for n customer)21.print: customer name owed amount22.print: customer[i-1] custOweAmt[i-1]23.end of loopExercise 8:Steps:1.print: “Enter 5 employs details”2.char emp_name[5];3.int emp_work_hour[5];4.float emp_pay_rate[5];5.for I = 1 to 5 when I value reaches to 5 then go to step 136.print: “enter name”7.name into emp_name[i-1];8.print: “enter total working hours”9.hours into emp_work_hour[i-1]10.print: “enter pay rate”11.pay rate ino emp_pay_rate[i-1]12.go to step 5 to enter details of next employee13.for I = 0 to 414. work_hour = emp_work_hour[i]
15.Check: if work_hour > 40 then otherwise go to step 2116. total_pay_rate = pay_rate[i]+ (pay_rate[i] / 2)17.Print: name is : emp_name[i]18.Print: regular pay is: pay_rate[i]19.Print: overtime hours: work_hour – 4020.Print: overtime pay: pay_rate[i] / 221.Print: gross pay: total_pay_rate22.Else 23.Print: name is : emp_name[i]24.Print: gross pay: pay_rate[i]25.Go to step 1326.End of for loopExercise 12:Steps:1.Repeat 3 timesWalk forwardEnd repeat2.Turn left 9 degreesRepeat 2 times Walk forwardEnd repeat3.Turn right 90 degrees4.Repeat 3 timesWalk forwardEnd repeat5.Trun 90 degree leftWalk forward6.Turn 90 degree right7.Repeat 4 timesWalk forwardEnd repeat8.Turn right 180 degrees9.Sit down

## End of preview

Want to access all the pages? Upload your documents or become a member.

### Support

#### +1 306 205-2269

Chat with our experts. we are online and ready to help.