Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

11. Study the algorithm shown in Figure 1-14 and then answer the questions. repe

ID: 3885013 • Letter: 1

Question

11. Study the algorithm shown in Figure 1-14 and then answer the questions. repeat 5 times: get the salesperson's name and sales amount calculate the bonus amount by multiplying the sales amount by 3% print the salesperson's name and bonns amount end repeat Figure 1-14 Algorithm for Exercise 11 Cengage Learning 2013 a. Which control structures are used in the algorithm? b. What will the algorithm print when the user enters Jake Harrington and 5500 as the salesperson's name and sales amount, respectively? c. How would you modify the algorithm to also print the salesperson's sales amount? salespeople? e. How would you modify the algorithm to allow the user to enter the bonus rate? The algorithm should then use that rate to calculate the bonus amount.

Explanation / Answer

11.

a) Since program repeat for 5 times, hence its WHILE LOOP control structure

b)

Input given by user(first line of code in the control structure) Jake Harrington and 5500 as salesperson name and sales amount.

The second line of the code in control structure calculates the bonus amount by multiplying the sales amount by 3%

So, bonus amount = 5500*3/100 = 165

The third line will print the sales person name and bonus amount.

Hence the algorithm above print following:

Jake Harrington 165

c)

repeat 5 times:

get the salesperson's name and sales amount

calculate the bonus amount by multiplying the sales amount by 3%

print the salesperson's name, bonus amount and sales amount

end repeat

d) //We can repeat n times where n is a number of sales people

repeat n times:

get the salesperson's name and sales amount

calculate the bonus amount by multiplying the sales amount by 3%

print the salesperson's name, bonus amount and sales amount

end repeat

e) //here instead of multiplying directly with 3%, we will multiply by bonus rate entered by user

repeat 5 times:

get the salesperson's name, sales amount and bonus rate

calculate the bonus amount by multiplying the sales amount to bonus rate

print the salesperson's name, bonus amount and sales amount

end repeat

12 // on step 5. its move 2 step forward instead of 3 step and on step 6. it should turn left 90 degrees instead of right 90 degrees

//Correct pseudo code

1. repeat 3 times

walk forward

end repeat

2. turn left 90 degrees

3. repeat 2 times

walk forward

end repeat

4. turn right 90 degrees

5. repeat 3 times

walk forward

end repeat

6. turn left 90 degree

7. walk forward

8. turn right 90 degrees

9. repeat 4 times:

walk forward

end repeat

10. turn right 90 degrees

11. sit down

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote