Assignment title: Information
Task
A video games club, AB Games, has many members who can connect to the AB Games servers and play many Play Station games (such as Assassin's Creed, Call of Duty, Minecraft, Nino Kuni and Naruto) online even without needing to have a Play Station. Each time they play a game they pay $2 on top of their monthly membership fees.
Many members discontinue with AB Games after some time. AB Games is very keen to identify reasons why members discontinue and thereby reduce attrition.
AB Games have a rich database on their members having information of each member on Age, Win-Loss Ratio, Number of Log-ins, Income and Status (i.e. whether continued or discontinued). They then run a data mining algorithm called SysFor, which automatically discovers logic rules on why some members discontinue while others continue. AB Games runs SysFor and fortunately you DO NOT have to code SysFor.
Assume that SysFor produces logic rules from a dataset and the logic rules are stored by SysFor in a text file called Rules.txt as follows.
GE stands for Greater than or Equal to, LT stands for Less Than, and the "-" sign indicates has no impact.
Other than the two header lines the Rules.txt file has five lines meaning that there are five logic rules. Each rule tells us the properties of the members who continue/discontinue.
The first rule states that if the Age of a member is greater than or equal to 25 and his/her Win-Loss ratio is greater than or equal to 8, then the member continues with the club. For ease of understanding, it can also be represented as: If Age >= 25 & Win-Loss >= 8 --> Continue. Similarly, the 2nd rule states that If Age >= 25 & Win-Loss < 8 --> Discontinue.
AB Games also has a dataset on their current members for whom AB Games does not know whether they will continue or discontinue. The dataset is stored in a file called Members.txt as follows.
In the Members.txt file there are two current members. The first member is 35 years old, has a Win-Loss ratio of 5, has logged in 512 times, and earns $20,000 per annum. The file also has similar information on the second member. However, the "?" mark for the variable Status indicates that AB Games at this stage does not know whether or not the members will continue with them.
Write a Python code that will match the members in the Members.txt file with the logic rules in the Rules.txt file to identify the Status of each member. Your Python code will then write a file calledMemberReport.txt as follows.
Since the first member in the Members.txt file has age greater than 25 and win loss ratio less than 8 he/she matches the 2nd rule in the Rules.txt file which suggests that he/she will discontinue. Similarly, the 2nd member matches the 3rd rule which suggests that he/she will continue.
Note that although the structure and schema of the Rules.txt file and Members.txt file will remain unchanged AB Games can change the values in the files. Additionally, the Rules.txt file can have any number of rules. Similarly, Members.txt file can also have any number of members. Your Python code should still produce correct MemberReport.txt file.
Rules.txt, Members.txt and MemberReport.txt files should be in the same folder as the Python code.
Use appropriate data structure in writing your code.
All exceptions need to be handled. Invalid inputs need to be handled and asked for a valid input again.
Use functions to make your program well designed, instead of just using a single main function. We expect you to use at least four (4) functions other than the main function.
Write an algorithm in structured English (pseudocode) that describes the steps required to perform the task specified. Some examples of pseudocode can be found athttp://www.unf.edu/~broggio/cop2221/2221pseu.htm.
Implement your algorithm in Python.
Avoid duplicate code.
Comment your code as necessary to explain it clearly.
Select 3 sets of test data that will demonstrate the correct "normal" operation of your program.
Run your program using the test data you have selected and save the output it produces in a text file.
Submit:
1. Your algorithm.
2. The table recording your chosen test data.
3. Source code for your Python implementation.
4. Output listings demonstrating the results of using the test data.
It is important that the output listings are not edited in any way.
Rationale
Reinforce topic material related to files and exceptions.
Reinforce topic material related to lists.
Marking criteria
Assessment Criteria
Performance Standards
FL
(Does not meet the PS requirements)
0 – 49 %
PS
(Meets the requirements below)
50 – 64 %
CR
(Meets PS requirements plus those below)
65 – 74 %
DI
(Meets CR requirements plus those below)
75 – 84 %
HD
(Meets DI requirements plus those below)
85 – 100 %
0 - .99 1 - 1.29 1.3 - 1.49 1.5 - 1.69 1.7 - 2.0 marks
Produce an algorithm in pseudocode (structured English).
(2 marks)
A significant number of errors in the produced algorithm.
Only a small number of errors in the produced algorithm.
It uses multiple functions.
It uses appropriate loops.
No errors in the produced algorithm.
File reading and writing is done as instructed in the assignment task. All variable names in the produced algorithm are meaningful.
A good design of the functions has been used.
All statements in the produced algorithm are necessary.
0 - .49 .5 - .64 .65 - .74 .75 - .84 .85 - 1.0 mark
Select appropriate test data.
Present the test results.
(1 mark) Selected test data are not clearly presented in a table or do not allow easy calculation of output.
Selected test data are clearly presented in a table and allow easy calculation of output.
Selected test data present normal operation of the code.
Sound reasons are provided for the selection of test data.
Test data explore every branch of the program.
Clear explanation provided of the expected output of the test results.
0 - 2.99 3 - 3.89 3.9 - 4.49 4.5 - 5.09 5.1 - 6 marks
Produce the necessary Python code.
(6 marks) The produced Python code does not execute properly, and/or contains syntax errors and/or produces incorrect results. The produced Python code executes properly without any syntax errors producing correct results.
It uses multiple functions.
It uses appropriate loops.
The produced Python code is fully documented with appropriate comments.
All variable names are meaningful.
File reading and writing is done as instructed in the assignment task.
The produced Python code implements the pseudocode correctly.
A good design of the functions has been used. The produced Python code contains only necessary statements and variables.
0 - .49 .5 - .64 .65 - .74 .75 - .84 .85 - 1.0 mark
Present the actual output of the program.
(1 mark) The presented test output does not match the actual results that can be obtained from the execution
of the program. The presented test output matches the actual results that can be obtained from the execution of the program. The presented test output is correct. The test output is correct for any test data in addition to those used in the submitted table to report the test result. The presented test output is in the form specified in the assignment.
Presentation
The same presentation requirements apply for Assignment 3 as did in Assignment 1.
Requirements
The same submission requirements apply for Assignment 3 as did for Assignment 1.
Note that for Assignment 3 you also need to submit the input text file/s.