Starting from:
$35

$29

Homework #5 Solution

Tasks
For All Students
    1. From HW #2, do #3 using lists for item names and prices.  This is the program that prints a receipt.
        a. Assume only 5 items and their respective prices.
        b. Create two blank lists: items & prices
        c. Use a FOR loop to INPUT and APPEND item names and respective prices to their respective lists.
        d. Use a FOR loop to print the items and prices.

For Graduate Students Only
    2. P6.32
        a. Do NOT create a function as the program directs.  Do it the way we have been doing thus far.
        b. You will need to use two lists: prices & isPet.
        c. Use WHILE loop and INPUT statements to populate the lists with their respective elements.  Use ENTER, not -1, as sentinel value.
    3. P6.33
        a. Do NOT create a function as the program directs.  Do it the way we have been doing thus far.
        b. You will need to use two lists: sales & customers.
        c. Follow directions from the programs above.

What to Turn-In?
    • A Word / PDF document
    • Follow previously provided guidelines

What You Will Need to Do in #3 Above
    • You will be able to find the maximum value in the sales list.
    • Find its index using the method provided in the textbook.
    • Once you know the index of the maximum sales, use that to determine the name of customer.  For example, if the maximum price is prices[2], the corresponding customer is customers[2].


More products