Question: CS 1120 (Python) - Spring 2021 LA1 the weekday calculator Lab Assignment 1 The weekday calculator Due Date (a two-week LA) Sections(540,543,544,545) 1/29/20 @ 11:59pm


CS 1120 (Python) - Spring 2021 LA1 the weekday calculator Lab Assignment 1 The weekday calculator Due Date (a two-week LA) Sections(540,543,544,545) 1/29/20 @ 11:59pm Concepts Review of CS1110 Concepts such as basic data structures, control flow structure and function in Python Use flow chart to design a function Problem Specification Develop an application in Python to determine the day of the week a person was born given his or her birthday, using the details specified below. You are to write a Python program that ask the user to input any birthdate using the formula mm/dd/yyy then split it into a month day, and year. Using a reference date such as 01/01/1920 (this reference date will be assumed in this assignment), which is a Thursday, you can count the number of days from the reference date to the birthdate to determine the weekday of the birthdate. Don't forget some leap years during the calculation. Assume that the user's birthdate > reference's date. Example: Assuming the user input 9/14/1981 then the program should print Monday, meaning the 14th of September of 1981 was a Monday. Design Requirements Basic Structure Your program should have the following functions: 1) The main function (named "main"). This function should ask the user to input any birthdate then call the getWeekday function to return the weekday of the birthdate then display it on the terminal. 2) A function (named "isLeap") that takes a year as a parameter and return either true (the year is a leap year) or false (not a leap year). 3) A function (named "daysPerMonth") that takes two parameters: month and year as numbers and return the number of days in that month of that year using isleap function. CS 1120 (Python) - Spring 2021 LA1 the weekday calculator 4) A function (named "daysPerYears") that takes two parameters: yeari and year2 as numbers and return the total number of days in those years using daysPerMonth function. 5) A function (named "get Weekday") that returns the weekday of the user birthdate as a string. You should count the number of days between the user and reference dates and since you know the weekday of the reference's date (for 1/1/1920 is Thursday) then you can tell what the weekday of the user's date is. For example, if user's birthdate is 1/9/1920 then the number of days between the two dates is 8 and since Thursday comes after every 7 days then the weekday is a Friday (think about it). Now to count the total days you will encounter three scenarios (possibly, the first and second together): a) Check if there are more than one year between the two dates. For example, birthdate's year is 5/5/1984. In this case, you must count days per year in all those years excluding 1920 and 1984 using the daysPerYears function b) Check if user's birthdate is in the next year after the reference's date. For example, user's birthdate is 6/12/1921. You must count the number of days from 1/1/1920 to 1/1/1921 (reference year) plus the number of days from 1/1/1921 to 6/12/1921 (birthdate's year) using daysPerMonth function. c) Check if user's birthdate and reference's date are both in the same year. For example, user's birthdate is 3/4/1920. Thus, no years are involved in the calculation, only months (and then use daysPerMonth function) and sometimes only days if both dates are in the same month. The output and interface should be neat and well-described. See the example provided in the Testing Phase section. All user input must be done with functions and the functions should clearly specify the range for each integer. A comment should be given for each function describing what the function does in terms of parameters and a return value. Flowchart You have to design a flowchart for each function to illustrate how function is designed. Also, you need to design a flowchart to show how the drive code is designed in terms of how inputs are received and the functions are called Implementation Phase Using the pseudocode developed, write the Python code for your assignment. This is a two-week assignment. CS 1120 (Python) - Spring 2021 LA1 the weekday calculator Testing Phase Your program should include code to validate user input and ensure that all input meets the specifications. If input is not valid, your program should keep looping to force the user to provide valid input. Each time your program loops, it should provide information to the user to indicate what is considered valid input. Build your program incrementally carefully testing each function as you go Example: This program is used to find the weekday of your birthday Please enter your birthdate: 1/2/1920 The weekday of 1/2/1920 is a Friday Additional Requirements Coding Standards You must adhere to all conventions in the CS 1120 Python coding standards (discussed in class and in the Lab). This includes the use of white spaces and indentations for readability, and the use of comments to explain the meaning of various functions and attributes. Be sure to follow the conventions also for naming variables, function parameters, and functions. Assignment Submission Generate a .zip file that contains all your files including: Program Files o Any input or output files Flowchart. Submit the zip file to the appropriate folder on E-Learning
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
