Question: using python 3: iNCLUDE MAIN FUNCTION IF POSSIBLE.. I ALWAYS RATE MY ANSWERS... here is the program that i need to fix..i will provide my

using python 3: iNCLUDE MAIN FUNCTION IF POSSIBLE.. I ALWAYS RATE MY ANSWERS... here is the program that i need to fix..i will provide my answer and feedback

.

HERE WAS MY ANSWER

from datetime import date def calcDiff(x,y): """

description: Create a function calcDiff that takes 2 parameters of type date and returns the difference of the dates precondition: parameters should be digits """ daysdiff= abs(x.day-y.day) yearsdiff= abs(x.year-y.year) print ("The given date differs from today's date by %d day(s) and %d year(s)" %(daysdiff,yearsdiff)) def getValidEntry(yr,month,day): """

description: create a function to make sure yr, month and day are valid entry precondition: parameters should be digits """ if (yr.isdigit() and month.isdigit() and day.isdigit()): return True else: return False def calcLateFee(dueDate,curDate,dailyfee): """

description: Create a function calcLateFee that takes 2 parameters of type dueDate, curDate (both are objects of type date) and dailyFee (a float). It should return the amount to be assessed as the late fee. precondition: curDate can be any date do NOT assume it is todays date! and dailyfee must be a float """ if dueDate

.HERE IS THE PROFESSOR FEEDBACK

Part 1:

Incorrect result:

#Part 1 Execution of the Program

Enter Year Month and Day in (Year-Month-Day) format:2017-12-1

The given date differs from today's date by 25 day(s) and 0 year(s)

============

Part 2: Incorrect result:

#Part 2 Execution of the Program

Enter Due date(In Year-Month-Day format):2017-11-25

Enter Cur date(In Year-Month-Day format):2017-11-27

Enter daily fee:10

Latefee:0

...........

Program 8- Using Python's DateTime Module Part 1: Create a function calcDiff that takes 2 parameters of type date and returns the difference of the dates. Note that the function should NOT print anything! Create a loop that Asks the user to enter a year, month, and day. Call the calcDiff function with today's date and the date entered by the user. Print the # of days AND the # of years that have passed. The loop should end when the user types END for the year. Reminders: Perform error-checking to ensure that the user enters only digits for each of the inputs (year, month, day) create a function getValidEntry that does the error checking. If the entry is not all digits, continue to ask the user for an entry until only digits are entered. Make sure your function does NOT return a negative number! Part 2: Create a function calcLateFee that takes 2 parameters of type dueDate, curDate (both are objects of type date) and daily Fee (a float). It should return the amount to be assessed as the late fee. curDate can be any date - do NOT assume it is today's date! daily Fee should be a float that indicates the amount per day to be charged if curDate - dueDate yields a negative number or 0, the function should return 0 as the amount. Scoring Guide: Part 1 (10 pts) calcDiff takes 2 parameters, returns difference of the dates (4 pts). checks to make sure a negative # isn't returned -2 if no check prints # of days (2 pts) prints # of years (2 pts) Loops continuously until user types END (2 pts) Missing error checking on entries for yr, month, day -2 Part 2 (10 pts) - calcLateFee takes 2 date objects as params and daily fee (float). Returns total late fee or 0 if no late fee

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!