Question: Write a Python program for processing checks and finding the day of the week using a popular formula. Ask the user for the type of
Write a Python program for processing checks and finding the day of the week using a popular formula. Ask the user for the type of processing to perform. For example, the user can enter 1 to calculate bank fees, 2 to calculate day of the week, 3 to quit. Any other choice should result in an error message without any calculations. 1. A bank charges $8 per month plus the following fees:
Number of checks fee 1 - 20 checks $.09 each 21 40 checks $.07 each 41 60 checks $.06 each More than 60 checks $.05 each
The program should ask the user for the number of checks and compute and display the fee. If the number of checks is a negative number or 0, issue an error message and set the fee to - 999. For example, if a person writes 10 checks, the fees displayed will be $8.9 (8 + 10*.09). If the number of checks is a negative number or 0, fee displayed will be -999. 2. Dont be intimidated by the Math for this question! The process of calculation is simple. We dont need to know anything about the Zillers rule to write this program. Mr. Ziller developed a formula to calculate the day of the week. You tell the formula what it needs, it comes back with the day of the week. Make sure the prompts are very descriptive. H = (q + 26(m+1)/10 + k + k/4 + j/4 + 5j) % 7 H is the calculated day of the week. 0: Saturday, 1: Sunday, ... 6: Friday. Your program should output the name of the day and not the number. q is the day of the month (1-31) m is the month number (3: March, 4: April, ..., 12: December). January and February are counted as month 13 and 14 of previous year. MAJOR HINT: For January, your code must convert the user input to 13 and for February, your code must convert the user input to 14 and change the year to the previous year in both cases. I see a couple of nice and short if statements here. j is the century (year / 100) k is the year of the century (year % 100) Note that the division in the formula should be integer division. Otherwise, the formula wont work! Ask the user to enter a year, month number (m), and day of the month (q). Make sure to ask for the values in the given order. Calculate and display the name of the day of the week.
Test run: Enter 1 to run the fee program, enter 2 to run the day of the week program, 3 to quit: 3 Thanks for using my program Enter 1 to run the fee program, enter 2 to run the day of the week program, 3 to quit: 1 Enter the number of checks: 10 Fee = $8.9 Enter 1 to run the fee program, enter 2 to run the day of the week program, 3 to quit: 1 Enter the number of checks: -8 Invalid number of checks has been entered - No processing will be performed Fee = $-999
Enter 1 to run the fee program, enter 2 to run the day of the week program, 3 to quit: 2 Please input year. 2015 Please input month. (1-12) 1 Please input day of the month. (1-31) 25 Sunday Enter 1 to run the fee program, enter 2 to run the day of the week program, 3 to quit: 5 Invalid choice
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
