Sunday, November 30, 2014

Practice Algorithms for Exams


  1. Prepare a table to display the range of 1 - 20 and the square and cube of each number.
  2. There is a huge Pre-Christmas sale at a local department store.  All items are being sold at 20% off; the discount is deducted at the cashier when the total bill is calculated.  Prepare an algorithm that calculates and outputs a customers' total bill after discount.  Output a list of items and their cost that the customer purchased.
  3. Fans are on sale for $25.00 each and customers can purchase as many as they want.  Prepare an algorithm that request the name of the customer and the amount of fans they would like to purchase.  The algorithm should output the total for each customer.  It should also count and output the number of customers that participates in the sale, as well as the total sale for the day.  The algorithm should output the name of the customer who purchases the most fans.
  4. Candy canes are being sold by the Prefects in the school as a Christmas fundraising event.  Students can order candy canes to send to their friends in other schools.  Each candy cane is being sold for $2.00.  Write an algorithm that calculates the total money collected by the fundraising event, based on each individual sale.  Students are to enter their names and the number of candy canes they want to purchase.  The algorithm should keep tally of the running total and output that amount when the program terminates with the word end.  The program should output the 3rd, 5th, and 8th student names entered.

No comments:

Post a Comment