13.10. Chapter Exercises

The following program segment should ask whether the user wants to terminate the program and print out the appropriate statement based on the user’s response. The blocks have been mixed up and include extra blocks that aren’t needed in the solution. Drag the needed blocks from the left and put them in the correct order on the right.

The following program segment should ask the user to first input two numbers which will serve as boundaries, then ask for a third number and determine whether it falls within the range of the first two numbers.

The blocks have been mixed up and include extra blocks that aren’t needed in the solution. Drag the needed blocks from the left and put them in the correct order on the right.

The program below is supposed to calculate the final bill for a meal at a fast food resteraunt in a state where meals taken to go are not taxed, but meals eaten in the resteraunt are.

Your job is to write the getTotalCost function. It should use the initial meal price and the location it is being eaten to calculate the final cost. If location has the string "to go" anywhere in it, the total cost should be just the meal price. Otherwise, it should be the price + 8% (1.08 times the meal price).

The program below is supposed to calculate the final bill for a meal at a fast food resteraunt in a state where meals taken to go are not taxed, but meals eaten in the resteraunt are.

Your job is to write the getTotalCost function. It should use the initial meal price and the location it is being eaten to calculate the final cost. If location has the string "to go" anywhere in it, the total cost should be just the meal price. Otherwise, it should be the price + 8% (1.08 times the meal price).

The program below is supposed to figure out the cost of a ticket for a customer to a museum. Anyone who is over 65 or younger than 12 gets in free. Anyone who is 12 to 17 gets in for $8. Everyone else is $15.

Your job is to write the getTicketCost function. It should use age parameter to decide on the right cost and then return that value. (Just return a number like 0, 8, or 15, don’t include $).

You have attempted of activities on this page