Question
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
- 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 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
- Include appropriate comments in the code
- Output should be displayed exactly as mentioned against each problem
- Indent the lines of code appropriately
- 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:
- Declare variables for food charges, tip, tax, and total.
- Constants for the tax rate and tip rate as .07 & .18.
- Get the food charges from the user
- Calculate the tip rate, tip = food * tip rate
- Calculate the tax, tax = food * tax rate
- Calculate the total.
- 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
- 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:
- Get the number of male students.
- Get the number of female students.
- Calculate the total number of students.
- Calculate the percentage of male students.
- Calculate the percentage of female students.
- Print the percentage of male students. Ex 0.53 %
- 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:
- Prompt user to enter an amount
- Find number of one dollars (remember to convert total amounts to pennies)
- Find umber of quarters in the remaining amount
- Find number of dimes in the remaining amount
- Find number of nickels in the remaining amount
- Find number of pennies in the remaining amount
- Display results
Sample Output:
Your amount 10.63 consists of
10 dollars
2 quarters
1 dimes
0 nickels
3 pennies
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started