Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Adhere to the naming conventions discussed in class for variable names, program name and function names Use meaningful names for variables If there are two


  1. Adhere to the naming conventions discussed in class for variable names, program name and function names
  2. Use meaningful names for variables
  3. If there are two words in the variable use first word lowercase and first letter of second wordupper case i.e., firstName or underscore between 2 words i.e first_name
  4. Include appropriate comments in the code
  5. Output should be displayed exactly as mentioned against each problem
  6. Indent the lines of code appropriately
  1. tax.py (20 Points)

Write a program that calculates the total amount of a meal purchased at a restaurant. The program should ask the user to enter the charge for the food, then calculate the amounts of a 18 percent tip and 7 percent sales tax. Display each of these amounts and the total.

Steps:

  1. Declare variables for food charges, tip, tax, and total.
  2. Constants for the tax rate and tip rate as .07 & .18.
  3. Get the food charges from the user
  4. Calculate the tip rate, tip = food * tip rate
  5. Calculate the tax, tax = food * tax rate
  6. Calculate the total.
  7. Print the tip, tax, and total with a $ sign and 2 decimal precisions. Ex total: $xx. xx

Sample Output:

Enter the charge for food: 99 Tip: $ 17.82 Tax: $ 6.93 Total: $ 123.75

  1. percentage.py (20 Points)

Write a program that asks the user for the number of males and the number of females registered in a class. The program should display the percentage of males and females in the class

Steps:

  1. Get the number of male students.
  2. Get the number of female students.
  3. Calculate the total number of students.
  4. Calculate the percentage of male students.
  5. Calculate the percentage of female students.
  6. Print the percentage of male students. Ex 0.53 %
  7. Print the percentage of female students

Sample Output:

Enter the number of male students: 12 Enter the number of female students: 34 Male: 0.26 % Female: 0.74 %

3. dollar.py (30 Points)

Write a program that finds number of Dollars, quarters, dimes, nickels, pennies given an amount.

Steps:

  1. Prompt user to enter an amount
  2. Find number of one dollars (remember to convert total amounts to pennies)
  3. Find umber of quarters in the remaining amount
  4. Find number of dimes in the remaining amount
  5. Find number of nickels in the remaining amount
  6. Find number of pennies in the remaining amount
  7. Display results

Sample Output:

Your amount 10.63 consists of

10 dollars

2 quarters

1 dimes

0 nickels

3 pennies

  1. cookies.py (30 Points)

Ingredients:

  • 1. 5 Cups of sugar
  • 1 cup of butter
  • 2.75 cups of flour

The above ingredients produces 48 cookies. Write a program that asks the user to enter how many cookies they want, then display the number of cups of each ingredients needed for the specified number of cookies.

Steps:

1. Prompt user to get the number of cookies.

2. Calculate the cups of sugar needed to make the cookies.

3. Calculate the cups of butter needed to make the cookies.

4. Calculate the cups of flour needed to make the cookies.

5. Print the amount of butter, sugar, and flour needed to make the specified number of cookies.

Sample Output:

Enter the number of cookies: 99 To make 99.0 cookies, you will need: 3.09 cups of sugar 2.06 cups of butter 5.67 cups of flour



Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions