COIT20245 Introduction to Programming Assignment Help

COIT20245 INTRODUCTION TO PROGRAMMING (HT2, 2024) Assignment 2 – Project 

Due date: 11:55 pm AEST, Sunday of Week 10 (22 September 2024) 

Weighting:  30%

Mode: Individual 

Submission:

Python files in a zip archive (.zip) 

Document including screenshots of program execution (.docx) 

Reflection report (maximum 500 words) (.docx) 

Full Mark: 60 

Problem Description 

This individual assessment requires students to design and implement a greatly simplified  Microsoft Excel- like spreadsheet application in Python using language features that have been  covered up to Week 10. The main data structure of this application is a table of rows and columns, where each cell (i,j) can hold a value of one of the data types including integer, float, or string. 

Learning Objectives 

By completing this assignment, students will: 

Gain experience with creating and using data structures. 

Develop a deeper understanding of Python’s composite data types, such as lists. Apply their knowledge of functions and methods. 

Enhance their problem-solving and algorithm design skills. 

Understand the implementation of basic spreadsheet functions. 

These learning objectives align with Unit Learning Outcomes 1-5. 

Project Phases 

This spreadsheet program will support several data types within its cells and implement several  basic spreadsheet functionalities like sum, average, min, max, data type conversion, and sorting.  The input and output of the spreadsheet program will be a CSV (comma-separated values) file. As a guidance for completing this project, the following three phases are recommended: 

1. Phase 1: Implement Data Structure and Basic Operations (including unit testing) 2. Phase 2: Implement Advanced Operations and Functionalities (including unit testing) 3. Phase 3: Implement User Interface and Overall Testing 

Phase 1: Implement Data Structure and Basic Operations 

Tasks:

1. Read and Write CSV Files: 

Write a function to read data from a CSV file to build the spreadsheet. Implement a function to write the spreadsheet data back to a CSV file. You should consider what kind of Python data types (basic and composite) to use to  implement the spreadsheet.  

You should also consider how to read from and write to a specific CSV file, given the  filename. 

2. Basic Functions: 

set_cell(spreadsheet, row, col, value): Set the value of a specific cell. get_cell(spreadsheet, row, col): Retrieve the value of a specific cell. 

display(spreadsheet): Print the spreadsheet to the console in a tabular format. Expected Output: 

A user can set and retrieve values from the spreadsheet. 

The spreadsheet is displayed in a tabular format. 

Phase 2: Implement Advanced Operations and Functionalities 

Tasks: 

1. Implement Excel-like Functions: 

sum_cells(spreadsheet, range): Sum the values within a specified range. average_cells(spreadsheet, range): Calculate the average of values within a specified  range. 

min_cells(spreadsheet, range): Find the minimum value within a specified range. max_cells(spreadsheet, range): Find the maximum value within a specified range. 

2. Data Type Conversion: 

convert_to_float(spreadsheet, row, col): Convert the value of the specified cell to a  float. 

convert_to_string(spreadsheet, row, col): Convert the value of the specified cell to a  string. 

3. Sorting: 

sort_row(spreadsheet, row): Sort the specified row in place if all values in the row are  of the same type. Otherwise, display the message “Cannot sort row: values are of  different types” without doing the sorting. 

sort_column(spreadsheet, col): Sort the specified column in place if all values in the  column are of the same type. Otherwise, display the message “Cannot sort column:  values are of different types” without doing the sorting. 

Expected Output: 

Users can perform arithmetic operations on ranges of cells. 

Data type conversions can be executed on specific cells. 

Rows and columns can be sorted in place. 

Phase 3: Implement User Interface and Testing 

Tasks: 

1. Command-Line Interface: 

Design and implement a simple command-line interface that allows users to interact  with the spreadsheet when the Python program is run. 

An example of the command-line interface might look something like: 

Options: 

1. Open CSV file 

2. Write to CSV file 

3. Insert/Update value in cell 

4. Read value in cell 

5. Sort row 

6. Sort column 

7. Sum of range 

8. Average of range 

9. Min of range 

10. Max of range 

11. Convert to float 

12. Convert to string 

13. Display spreadsheet 

0. Exit 

Enter your choice: 

2. Testing: 

Write unit tests for each of the functionalities implemented. 

Ensure the spreadsheet handles boundary cases and errors gracefully.

Expected Output: 

A working command-line interface. 

Comprehensive test coverage for all functionalities. 

Program Testing 

A sample CSV file, input.csv, for testing is provided in the Assignment 2 folder on  Moodle. Note that when we mark your program, we might use additional CSV files. The following set of Python statements are provided to help test the basic and advanced  

functionalities of your program. It does not test the command line interface that allows a user to interact with the spreadsheet. You should thoroughly test your command line interface. 

#Program Testing: 

#A command line interface should be designed and implemented #to prompt user to input filename, designate the cell to read or #write a value, execute functions like sum, average, max, min, type #conversion, sort a row or sort a column, display the spreadsheet, 

#and read and write files.  

spreadsheet = read_csv(‘input.csv’) 

set_cell(spreadsheet, 0, 0, 5) 

set_cell(spreadsheet, 0, 1, 10) 

set_cell(spreadsheet, 0, 2, 15) 

set_cell(spreadsheet, 1, 0, 20) 

set_cell(spreadsheet, 1, 1, 25) 

display(spreadsheet) 

print(“Sum:”, sum_cells(spreadsheet, ((0, 0), (1, 1)))) print(“Average:”, average_cells(spreadsheet, ((0, 0), (1, 1)))) print(“Min:”, min_cells(spreadsheet, ((0, 0), (1, 1)))) print(“Max:”, max_cells(spreadsheet, ((0, 0), (1, 1)))) sort_row(spreadsheet, 0) 

sort_column(spreadsheet, 1) 

convert_to_float(spreadsheet, 0, 0) 

convert_to_string(spreadsheet, 0, 1) 

display(spreadsheet) 

write_csv(‘output.csv’, spreadsheet) 

The output displayed to the console, in addition to the creation of the CSV file, output.csv

5 10 15 

20 25 136.49 

3 69.4 153.03 

4 68.22 142.34 

5 67.79 144.3 

6 68.7 123.3 

7 69.8 141.49 

8 70.01 136.46 

9 67.9 112.37 

10 66.78 120.67 

Sum: 60.0 

Average: 15.0 

Min: 5.0 

Max: 25.0 

5.0 10 15 

20 25 136.49 

3 66 153.03 

4 67 142.34 

5 67 144.3 

6 68 123.3 

7 68 141.49 

8 69 136.46 

9 69 112.37 

10 70 120.67

Written Reflection (Maximum 500 words) 

Summarize your learnings from this assignment. 

Reflect on the strengths and limitations of the implemented spreadsheet data structure and  functions. 

Suggest potential improvements on the implementation. 

Submission 

The assignment submission should include the following files: 

1. Python files in a zip archive (.zip) 

2. Document including screenshots of program execution (.docx) 

3. Written Reflection (.docx) 

Marks will be deducted for not following these instructions. Late submission will incur a late  penalty (5% of the total mark per day) as per the university’s Assessment Policy and Procedure. 

Marking Criteria and Rubric (maximum 60 marks)

Criteria

Excellent (85-

100)

Good (70-84)

Satisfactory (50-

69)

Poor (0-49)

Marks

 

 

Phase 1

Excellent design with clear,
logical structure and efficient use of

data structures

Good design with
mostly clear structure and appropriate

data usage

Satisfactory design,
but with some
inefficiencies or

unclear structure

Poorly designed, inefficient, or unclear structure

 

 

10

 

 

Phase 2

All required functions implemented correctly with additional features

Most required functions implemented correctly

Basic functions implemented, some
issues

Many functions not implemented or mostly incorrect

 

 

25

 

Phase 3 – 1

Intuitive and fully
functional command-line interface

Functional interface, mostly intuitive

Basic interface, some
usability issues

Poor interface, difficult to use or incomplete

 

10

 

 

Phase 3 – 2

Comprehensive testing
with screenshots of
program execution

Good testing with screenshots
of program

execution

Basic testing with
limited screenshots of program

execution

Little or no testing
with little to no screenshots of program

execution

 

 

5

 

Code Quality and Documentation

Excellent code quality,
well-
documented with
meaningful comments

Good code quality, well-
documented

Satisfactory code
quality, some documentation

Poor code quality, little
or no documentation

 

 

5

Written Reflection

Comprehensive and insightful

Good reflection with some

Basic reflection with minimal

Poor
or
incomplete

5

 

Criteria

Excellent (85-

100)

Good (70-84)

Satisfactory (50-

69)

Poor (0-49)

Marks

reflection, well-
written and detailed

insights and detail

insights

reflection, lacking insights or detail

 Each student must write the Python programs and the Reflection themselves. You may be asked to prove that you have written these items. You should keep evidence that you have written them  yourself, for example, early drafts of the Python code and your Reflection. 

ALL assignments will be checked for plagiarism (materials copied from other students and/or  material copied from other sources) using TurnItIn. If you are found to have plagiarized material  or if you have used someone else’s words without appropriate referencing, you will be penalized for plagiarism which could result in zero (0) marks for the whole assignment. If you falsify  references/information you will also be penalized. In some circumstances, a more severe penalty  may be imposed such as having a plagiarism incident raised. Please refer to CQUniversity’s  policy and procedure on academic integrity for details. 

Once the assessment is marked, the Unit Coordinator (or nominee) may request additional written information and/or an oral discussion to clarify the student’s understanding of the submitted work. Failure to comply and/or to demonstrate an understanding of the  assignment’s submitted items could result in 0 marks for the assignment.