Changes

Jump to: navigation, search

OPS435 Python Assignment 2

869 bytes added, 15:59, 14 March 2019
Bonus item 10% extra
== Tasks for this assignment ==
In this assignment, your task is to should preform the following activities:# work Work out an algorithm for producing daily, weekly, and monthly usage reports by user or by remote host based on the information obtained from the 'last' command or any given files which contain similar information as the 'last' command. # Once you believe you have a workable algorithm, you should then identify <b>design the structure of your python script</b> by identifying the appropriate python objects and functions to be used for each task in your algorithmand the main control logic. Make sure to identify all the input data,computation tasks, and outputs.# implement your computational solution using a single python script. You can use any built-in functions and functions from the allowed python modules in to implement your scriptsolution.# review your working python code to see whether you can improve the interface of each function and to facilitate better code re-use (this process is called <b>refactoring</b>).
== Allowed Python Modules for this assignment ==
== Suggested Script Development and Testing ==
The following python functions (to be created) are useful in handling the following sub-tasks:
* gets login records from the output of "last" command and filters out unwanted records
* reads login records from files and filters out unwanted records
* generate convert login records into proper python object type so that it can be processed using as much built-in functions as possible * create function which generates daily usage reports by user and/or by remote host* generate create function which generates weekly usage reports by user and/or by remote host* generate create function which generates monthly usage reports by user and/or by remote hostTo help you with this assignment, [[OPS435 A1 Usage Report Template|here is a template]] you can use as a starting point in developing designing your own Python Usage Report script.
For each function, identify what type of objects should be passed to the function, and what type of objects should be returned to the caller. Once you have finished coding a function, you should start a Python3 interactive shell, import your functions and manually call the function you want to test under interactive modeand verify its correctness.
Once you have all the individual function tested and that each is working properly, perform the final test with test data provided by your professor and verify that your script produces the correct results before submitting your python program on Blackboard.
! Task !! Maximum mark !! Actual mark
|-
| Program Authorship Declaration Algorithm and program design||1 15 ||
|-
| Program usage Authorship Declaration || 2 5 ||
|-
| Program Options usage || 2 5 ||
|-
| Generate user name list Program Options || 2 15 ||
|-
| Generate remote host IP user name list|| 2 10 ||
|-
| Daily Usage Report by User Generate remote host IP list|| 2 10 ||
|-
| Daily Usage Report by Remote Host User || 2 10 ||
|-
| Weekly Daily Usage Report by User Remote Host || 2 10 ||
|-
| Weekly Usage Report by Remote Host User || 2 5 ||
|-
| Monthly Weekly Usage Report by User Remote Host || 2 5 ||
|-
| Monthly Usage Report by Remote Host User || 2 5 ||
|-
| pass verbose option test Monthly Usage Report by Remote Host || 2 5 ||
|-
| pass multiple input data file || 2 || |-| '''Total''' || 25 100 ||
|}
== Bonus item 10% extra ==
* Create a function to capture that output of the 'last -Fiw' on the system your script is being executed and return the contents in the type of object as what you get from a regular login/logout record file.
* Call this function and use the objects it returned when the file name input at the command line is 'last'.
== Submission ==
After fully testing your program, submit your python script ur_[student_id].py and your algorithm and program design report ur_[student_id].pdf in pdf format on Blackboard by November 30April 5th, 20182019.
1,760
edits

Navigation menu