Programming Paper Due In 10 Hours


Part I :This lesson’s Group Activities are (do both):

  1. A customer is in a store to purchase 3 items. Write a program which asks for the price of each item, uses 5.5% for sales tax, then displays:
    1. the subtotal of the sale
    2. the total amount of tax to be collected
    3. the total amount the customer must pay
  2. A family is dining out at a kid-friendly restaurant. Write a program which asks the user to enter the total cost of food and drink, then calculates the total bill including an appropriate tip and a 6.5% sales tax rate. Display the subtotal, the tip, the tax, and the total amount of the bill.

Helpful Hint: When you are running your program using the console, it will automatically close when the program completes. Often times, this means you never get to see your output statements because the console closes right away. When you are trying to debug – or trying to make a useful application for your clients – this is really, really annoying. A simple way to keep the console open is to end your applications with something similar to

print(input(‘\n\nHit Enter to Close\n’))

This will keep the console open at the end of the program until you (or your end user) hits the Enter key. It also helps your instructor grade your programs much easier/quicker (wink, wink).

You are to:

  1. Post your code for each exericse in the Lesson 1 Group Activities discussion board (click the Lesson 1 Group Activities link above)

 

Part II:

This activity is worth 10 total points

This week’s Lab is:

  1. The Python Rocks amusement park has a tiered admission policy:
Height of Guest Tier Name Cost of Ticket
 less than 30 inches  Guppy  free
 30 inches or more, but less than 36 inches  Pollywog  $2
 36 inches or more, but less than 42 inches  Apprentice  $5
 42 inches or more, but less than 48 inches  Explorer  $8
 48 inches or more  Adventurer  $10

Write a program which asks the user to enter the height of the guest, then displays name of the correct tier and the cost of the ticket.

You are to:

  1. Work through this Lab on your own (no peer help; no copying code from any source)
  2. Submit your own completed Lab file(s) here (click the link above)
  3. Leverage as many tools, functions and methods as covered in this lessons reading!

 

 

Part III: This lesson’s Group Activities are (do both):

  1. A U.S. customary gill is a measure of volume that is equal to 32 fluid drams. One dram is equal to 1/8 of a U.S. fluid ounce. Yes, these are real measurements. If you know the number of fluid ounces, you can calculate the number of drams (d) as:

drams = ounces * 8

and the number of gills as

gills = ounces / 4

Write a program that asks the user to enter the number of ounces of apple cider they want to purchase to take home. It should then calculate and display the correct number of gills and drams. If the result is more than 1024 drams, a message should display indicating that the amount they want is large and they will need to purchase their cider in gallons. If the result is less than 100 drams, a message should display indicating that the amount they want is too small and perhaps they should just order a pint.

  1. When mixed, the primary colors – red, blue, and yellow – create secondary colors – orange, green, and purple.
    • Mix red and blue to get purple
    • Mix blue and yellow to get green
    • Mix yellow and red to get orange

Design a program which prompts the user to enter two of the primary colors. If anything other than “red” “blue” or “yellow” is entered, the program should display an error message. If they enter two of the same color, an error message should display. Otherwise, the program should display the name of the new secondary color.

Helpful Hint: you can convert any string into lowercase by using the method lower(). For example:

letters = ‘WXYz’
print(letters.lower())

This will display:

wxyz

You may find this helpful in case your end user enters “RED” or “Red” instead of “red.”

You are to:

  1. Post your code for each exercise in the Lesson 2 Group Activities discussion board
  2. Respond to your classmates, providing assistance or commentary as needed
  3. Follow the guidelines for Group Activities which are found under Course Information

 

 

Part IV: Lesson 2 Challenges

 

Complete the challenge.

 

\