Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
image text in transcribed
LA1 the weekday calculator CS 1120 (Python) - Spring 2021 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/yyyy 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 14 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 inot a leap year). 3) A function (named "daysPer Month" that takes two parameters month and year as numbers and CS 1120 page....pdf lovepal pages- CS 1120.pdf O Resoare MacBook Pro LA1 the weekday calculator CS 1120 (Python) - Spring 2021 4 A function (named "daysPer Years") that takes two parameters: years and year2 as numbers and return the total number of days in those years using days Per Month 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 ). 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 daysPer Years function b) Check 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 days Per Month 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 preudocode developed, write the Python code for your assignment. This is a two week assignment C$ 1120.page-0 pdf loveout pages-20 CS 1120.pdf Research Assi LA1 the weekday calculator CS 1120 (Python) - Spring 2021 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 Any input or output files Flowchart Submit the zip file to the appropriate folder on E-Learning CS 1120_page-0.pdf Bovepat pages... 5 CS 1120.pdf Research Assis Marie LA1 the weekday calculator CS 1120 (Python) - Spring 2021 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/yyyy 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 14 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 inot a leap year). 3) A function (named "daysPer Month" that takes two parameters month and year as numbers and CS 1120 page....pdf lovepal pages- CS 1120.pdf O Resoare MacBook Pro LA1 the weekday calculator CS 1120 (Python) - Spring 2021 4 A function (named "daysPer Years") that takes two parameters: years and year2 as numbers and return the total number of days in those years using days Per Month 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 ). 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 daysPer Years function b) Check 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 days Per Month 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 preudocode developed, write the Python code for your assignment. This is a two week assignment C$ 1120.page-0 pdf loveout pages-20 CS 1120.pdf Research Assi LA1 the weekday calculator CS 1120 (Python) - Spring 2021 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 Any input or output files Flowchart Submit the zip file to the appropriate folder on E-Learning CS 1120_page-0.pdf Bovepat pages... 5 CS 1120.pdf Research Assis Marie

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 1 Lnai 6321

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215879X, 978-3642158797

More Books

Students also viewed these Databases questions

Question

Design a health and safety policy.

Answered: 1 week ago