• This file contains details of a valid car rego numbers. Each rego number is a six-alphanumeric such as A1B2C3. (Note: Two records in the file have intentionally been -corrupted- - for testing purposes.)
• A1B2C3 Peter McDonald
• MYREGO Mary Smith
• ITC415 Katy Perry
• JO12
• HELLO1 Iam Botham
• HE11O1 Peter Adams
• ABC123 Nelson Mandela
• HI5HI5 Kevin Jones
• HELLO
• ABC123 John White
• ITC106 Alan Parker
• TT63YY Anil Patel
• ALAN13 Brian Lara
• MYCARNO Smith Wills
• Susan Sugar
• 87MYNO Margaret Bongs
Design an algorithm and use it to write a Python program that reads the contents of the data file into a list. The program should then loop, to allow a user to check various numbers against those stored in the list. The loop should terminate when an -empty- input occurs - i.e. when the user presses the [Enter] key on its own. (Obviously this last entry should NOT be checked against the list!) If the rego number input matches an element somewhere in the list, the program should display the number together with a message saying that it IS a valid rego number. If the number input does not match any element in the list, then the program should display the number and a message saying that it IS NOT a valid rego number.
Notes:
The algorithm should be written in pseudocode (structured English).
The records read from the data file should be checked and NOT placed into the list if they are something other than a 6-alphanumeric. (Display a sensible message if the file is found to have corrupt records in it.)
The numbers entered by the user should be checked to ensure they are valid alphanumeric (as distinct from valid rego numbers) and not processed further if they are not.
Your programs should use one or more functions where sensible, and be documented fully.
Use exceptions where necessary.
Specify 3 sets of test data that will demonstrate the correct ‘normal’ operation of your program. Show your test data in a table as you have done in earlier assignments.
Run your program using the test data you have selected and save the output produced in a single text file.
Submit:
1. Your algorithm and test data table.
2. The table recording your chosen test data.
3. Source code for your Python implementation.
4. Output test file demonstrating the results of using the test data.
5. Contents of the data file cars.txt read by the program.
It is important that the output listings are not edited in any way.
Submit to Turnitin. Please use the login details given in CSU Interact2 Announcements.
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.
Exceptions are handled. 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 marks) 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
You MUST prepare and present all source code, output from test runs, and other documentation as separate files within a single directory (folder) identified by your name. This directory will later be compressed into a single ZIP file - see the -Requirements- section below.
o The Python source code you write should be saved with a name such as ITC106_Ass_1.py by choosing File Save As, from the IDLE -edit- window.
o The test run (or runs) produced when your Python program executes should be saved with a name such as ITC106_Ass_1.txt by choosing File Save As, from the IDLE -run- window. (N.B. When testing your final program, start with a new (empty) run window, perform ALL necessary test runs one after the other, then when finished save the contents of the -run- window into ONE file showing ALL test runs in the order that you carried them out. This order should match the order of the test in your -test data table-).
o The other documentation (such as your pseudocode, and your table of test data etc.) should be saved in a Word document with a name such as ITC106_Ass_1.doc.
Thus your directory for Assignment A1 will contain three files - and be identified with your name (and not the name of the subject or the assignment).
It is critically important that your test runs (saved as one file with a .txt extension) are unmodified outputs from your program, and that these results should be reproducible by the marker running your saved .py python program in IDLE. In this subject test runs, and python program listings are NOT to be cut and pasted in any form from the IDLE windows. (For example you might be tempted to cut the output from test runs and to paste it into a Word document to create a -pretty- assignment with headers and footers the way you might be used to doing for other subjects. DO NOT DO THIS! The un-edited contents of the -edit- and -run- windows from IDLE is all we want to see in the .py program listing file and the .txt test run file.)
Requirements
Once you have saved the three files (as described under -Presentation- above) into a single directory identified by your name, you MUST compress that directory into a single ZIP file (and only a ZIP file - not a RAR file or some other compressed file format), as outlined in the section on presentation. Failure to adhere to these requirements will attract a 10% penalty.
GET ANSWERS / LIVE CHAT