Reference no: EM132330012
*Question 1. Harold is five steps away from his cat Ginger, who is an unknown distance away from a chair, as illustrated in Figure 1-8. Using only the instructions listed in the figure, create an algorithm that directs Harold to step over Ginger and sit in the chair. You may use an instruction more than once. In the repeat (x times) instruction, replace x with the appropriate number of times you want the loop instruction(s) repeated. Be sure to indent the instructions appropriately. (The answers to TRY THIS Exercises are located at the end of the chapter.)

Figure 1-8: CrazyTalk Animator
*Question 2. A store gives a 15% discount to customers who are at least 55 years old, and a 10% discount to all other customers. Using only the instructions shown in Figure 1-9, write an algorithm that displays the amount of money a customer owes. Be sure to indent the instructions appropriately. (The answers to TRY THIS Exercises are located at the end of the chapter.)
Calculate the amount due by subtracting the discount from the sales amount
Calculate the discount by multiplying the sales amount by 10 %
Calculate the discount by multiplying the sales amount by 15 %
Display the amount due
else
end if
enter the customer's age and the sales amount
If (the customer's age is less than 55 )
Figure 1-9
Question 3. Modify the algorithm shown earlier in Figure 1-5 so that it gives a 25% discount if the customer buying a TV is an employee of the store; all other customers buying a TV should receive a 15% discount.
*Question 4. Using only the instructions shown in Figure 1-10, create an algorithm that displays the average of four numbers. Be sure to indent the instructions appropriately.
calculate the average by dividing the sum by 4
calculate the sum by adding the number to the sum
display the average
end repeat
enter a number
repeat (4 times)
Figure 1-10
Question 5. You have just purchased a new personal computer system. Before putting the system components together, you read the instruction booklet that came with the system. The booklet contains a list of the components that you should have received. The booklet advises you to verify that you received all of the components by matching those that you received with those on the list. If a component was received, you should cross its name off the list; otherwise, you should draw a circle around the component name in the list. Using only the instructions listed in Figure 1-11, create an algorithm that shows the steps you should take to verify that you received the correct components. Be sure to indent the instructions appropriately.
Circle the component name on the list
cross the component name off the list
else
end if
end repeat
if (the component was received)
read the component name from the list
repeat for (each component name on the list)
search for the component
Figure 1-11
*Question 6. Using only the instructions shown in Figure 1-12, write two versions of an algorithm that displays the total amount each customer owes for concert tickets. Be sure to indent the instructions appropriately.
calculate the amount owed by multiplying the number of tickets by $35
display the amount owed
display the message "you can purchase up to 4 tickets only."
else
end if
end repeat
enter the number of tickets
If (the number of tickets is greater than 4)
if (the number of tickets is Less than or equal to 4)
repeat for (each customer)
figure 1-12
Question 7. Harold is standing in front of a flowerbed that contains six flowers, as illustrated in Figure 1-13. Create an algorithm that directs Harold to pick the flowers as he walks to the other side of the flowerbed. He should pick all red flowers with his right hand. Flowers that are not red should be picked with his left hand. Use only the instructions shown in the figure; however, an instruction can be used more than once. Be sure to create an algorithm that will work for any combination of colored flowers.
*Note: only need problems 1,2,4,6,8.