Open main menu

CDOT Wiki β

Changes

OPS435 Assignment 1 for Section B

398 bytes added, 14:23, 3 February 2021
The 2nd Checkpoint - your drafted Python Script (Feb 22)
= Assignment Requirements =
== The First Checkpoint (Oct 13Feb 15) ==* Before you begin coding in Python, it is important to plan your algorithm. Therefore your first task will be to complete and submit an algorithm document. This document should be named '''algorithm_[student_idSeneca_name].txt'''. This file should be plaintext. The document will contain two sections: :* <code>A description of how your main program works. The main program flow is provided to you in a1_template.py. Open the file, and use clear English to describe what each line of code does in such a way that a competent Python coder could reproduce the code without seeing it firsthand.</code> :* <code>You will then apply the same principles to create an algorithm for each validation function named in the a1_template.py file. Inside the code, if you are calling another function like "leap_year()", you may simply describe what the function will return, and not the operation of the function itself. </code> * This file should be submitted to Blackboard by Oct 13Feb 15, 20202021, and should be your first priority. The objective of the first checkpoint is not to have a 100% perfect algorithm, but to plan ahead and anticipate challenges and issues with the assignment. The first checkpoint will also allow your professor an opportunity to give you feedback before the assignment overall due date.
* [https://simple.m.wikipedia.org/wiki/Algorithm Here is an basic introduction to Algorithm]
* While you are working on the step-by-step instructions, note that there are different number of days in each month and some years have 365 days and some years have 366 days.
* Since we don't think we are going to encounter someone who is 120 years or older, your algorithm can consider a date of birth before year 1900 as invalid. Could you think of other limit you should put on someone's date of birth?
== The 2nd Checkpoint - your drafted Python Script (Oct 16Feb 22) ==
* As stated before, your code will be inside the file "a1_[Seneca_name].py". The first step will be to clone the Assignment 1 template repository (https://github.com/rayfreeping/ops435-a1). Once you clone the repository, run this command: "cp a1_template.py a1_[Seneca_name].py". (Replace Seneca_name with your Seneca account user name). Begin coding your algorithm into Python code that is required. Additional requirements are outlined below.
* Your should update the author and date information in your Python script.
* Your Python script file a1_[Seneca_name].py should be submitted to Blackboard by Oct 16Feb 22, 20202021. * The script doesn't have to be perfect and error free. However, it shouldn't contain any syntax errors when exectuedexecuted.* This intern submission is just to show that you are activity actively working on your assignment.
== The 3rd Checkpoint - preliminary test results (Oct 20Feb 25) ==
* Run the preliminary test script named "checkA1.py" in the "tests" sub-folder of the ops435-a1 repository mentioned above.
* Please read the readme.txt in the tests sub-folder for more information about the purpose of the preliminary test script.
* When your are satisfy with the test result, capture the test result to a file named a1_pretest.txt and submit it together with your Python script a1_[Seneca_name].py to Blackboard by Oct 20Feb 25, 20202021.
== Python Coding Requirements ==
<b><font color='blue'>Your python script is allowed to call all the built-in functions and the functions imported from the <u>os, subprocess and sys</u> modules from the standard library.</font></b>
Based on the algorithm you have designed for this assignment, you should at least have the following four five functions defined in your python script (see later section on the purpose of each function):
* leap_year()
* range_check()
* sanitize()
* size_check()
* value_check()
* usage()
* sanitize()
=== Coding Standard ===
=== Command Line Argument to be supported ===
* Your Python script must support one command line argument only: date in the following format with correct values in YYYY, MM, and DD should be considered as valid input data:
** <code>YYYYMMDD</code>** <code>YYYY/MM/DD</code>** <code>YYYY-MM-DD</code>** <code>YYYY.MM.DD. </code> * If there are no argument, more than one argument, or an invalid year, month, or day, your script should display the appropriate usage message, error code, and exit.
=== Documentation ===
* <b><code>python3 a1_rchan.py 2020.02.29</code></b>, and the output should be<br />
Feb 29, 2020
* <b><code>python3 a1_rchan.py 2019.02.2829</code></b>, and the output should be<br />
Error 03: wrong day entered
* <b><code>python3 a1_rchan.py 2019.13.12</code></b>, and the output should be<br />
Error 10: year out of range, must be 1900 or later
* <b><code>python3 a1_rchan.py 189802</code></b>, and the output should be<br />
Error 09: wrong data date entered
If there is too few or too many command line argument given, display the proper usage:
* <code>Usage: a1_rchan.py YYYYMMDD|YYYY/MM/DD|YYYY-MM-DD|YYYY.MM.DD ></code>
== Script structure and sample template ==
The following is a brief description of each function:
* The leap_year() function will take a year in "YYYY" format, and return True if the given year is a leap year, otherwise return False.
* The size_check() function * The valid_daterange_check() function will take an integer object and a tuple with two integer values, the first value indicates the lower bound and the second one indicates the upper bound of a date integer range. If the integer object falls in "DD-MM-YYYY" formatbetween the range given in the tuple, and return 'True if the given date is a valid date', otherwise return 'False plus an appropriate status message'. * The valid_datesanitize() function should make use of will take two string objects, the first string object is the object to be sanitized, and the days_in_mon() 2nd string object contains letters that are allowed. This functionwill return the first object with letters not in the 2nd string object removed.* The days_in_monsize_check() function will take a year in "YYYY" format, an collection data type object and expected number of items as an integer and will return a dictionary object which contains either 'True' or 'False'. If the total number of days items in each month for the data object match the integer value given year. The days_in_mon() function should make use of the leap_year() function., return 'True', otherwise return 'False'
* The usage() function will take no argument and return a string describing the usage of the script.
| Check script passed || 30 ||
|-
| todaysize_check() function design || 2 4 ||
|-
| beforesanitize() function design || 5 4 ||
|-
| dbdaleap_year() function design || 10 4 ||
|-
| script level docstring range_check() function design || 5 4 ||
|-
| leap_yearusage() function design || 2 4 ||
|-
| valid_date() function design script level docstring || 5 ||
|-
| usage() function design level docstring || 1 5 ||
|-
| First Milestone Checkpoint ||10||
|-
| Reflection Essay Second Checkpoint || 10 ||
|-
| github.com repository: Commit messages and use ||15||
Please submit the following files by the due date:
* [ ] your algorithm document, named as 'algorithm_usernamealgorithm_[Seneca_name].txt', to Blackboard.* [ ] your python script, named as 'a1_[seneca-idSeneca_name].py', should be included in your repository, and also '''submitted to Blackboard.'''* [ ] the output of the checking script checkA1.py, named as 'a1_outputa1_pretest.txt', should be included in your repository.* [ ] your debrief document should be , and also '''submitted to Blackboard.'''
1,760
edits