Wednesday, August 5, 2020

Assessment item 3 - File Processing



Value: 15%
Due Date: 04-Oct-2020
Return Date: 26-Oct-2020
Submission method options: Alternative submission method
In this assignment you will use turtle graphics to create a drawing from data stored in files. You can reuse the easyshape module developed in the previous assignment. However, in this assignment, the drawing commands will be read from a file specified by the user, rather than user input.
Drawings will be stored in a text format in which each line represents one command. For example, the following file:
S,black,2
L,50,0,250,0
A,50,90
L,300,150
A,50,90
L,50,200
A,50,90
L,0,50
A,50,90
S,green,1
T,Good,60,50,50

Will produce a shape similar to the following:

Before executing the commands in the file, the program must check the entire file content to ensure it is in the correct format. If there is any error in the file content, the program must display a useful error message, informing the user about the lines containing errors, then exit. The program should be able to tolerate minor errors such as lowercase letters or extra spaces before or after commas. Also, the program should be able to handle all exceptions including TypeError, ValueError, FileNotFoundError or any other exceptions. Whenever possible, use input validation to prevent exceptions rather than handling them afterwards.

Constraints
  1. You must utilise sequence types such as lists, tuples or dictionaries in your program.
  2. You must not import any modules other than turtle and your own created modules.

Your assignment should consist of following tasks.
Task 1
Draw two flowcharts that represent the file processing and file checking algorithms. You can abstract the defined functions using function symbols, but the main flowcharts should provide sufficient level of details for the logic of your algorithms.
You can draw the flowcharts with a pen/pencil on a piece of paper and scan it for submission, as long as the handwriting is clear and legible. However, it is strongly recommended to draw flowcharts using a drawing software.
Task 2
Select six sets of test data that will demonstrate the 'normal' operation of your program; that is, test data that will demonstrate what happens when a VALID input is entered. Select four sets of test data that will demonstrate the 'abnormal' operation of your program.
Set out the test cases in a tabular form as follows. It is important that the output listings (i.e., screenshots) are not edited in any way.

Test Data Table
Test data typeTest dataThe reason it was selectedThe output expected due to the use of the test dataThe screenshot of actual output when the test data is used
Normal    
Normal    
Normal    
Normal    
Normal    
Normal    
Abnormal    
Abnormal    
Abnormal    
Abnormal    

Task 3
Implement your algorithm in Python. Comment on your code as necessary to explain it clearly.  Run your program using the test data you have selected and complete the final column of test data table above.
Your submission will consist of:
  1. Your algorithm through flowchart/s
  2. The table recording your chosen test data and results
  3. Source code for your Python implementation
Thus your directory for Assignment will at least contain two or three files (depending on whether you put the flowchart and the test table in the same file).

It is critically important that your test runs are unmodified outputs from your program, and that these results should be reproducible by the marker running your saved .py python program.

Rationale
This assessment task will work towards assessing the following learning outcome/s:
  • be able to analyse the steps involved in a disciplined approach to problem-solving, algorithm development and coding.
  • be able to demonstrate and explain elements of good programming style.
  • be able to identify, isolate and correct errors; and evaluate the corrections in all phases of the programming process.
  • be able to interpret and implement algorithms and program code.
  • be able to apply sound program analysis, design, coding, debugging, testing and documentation techniques to simple programming problems.
  • be able to write code in an appropriate coding language.

No comments:

Post a Comment

Python Files and Exceptions: Unit 9

  Table of contents Reading from a File Reading an Entire File File Paths Reading Line by Line Making a List of Lines from a File Working wi...