# ITC558 Programming Principles Assignment

### Subject Overview

This subject introduces students to the programming procedure. It starts with the development of problem-solving skills associated with the development of problem-solving skills relevant to the solution of various programming problems. This subject one of the basic subject of other studies in information technology because it develops skills, approaches, and techniques that underpin many other areas of the discipline of computing.

Value: total value of this assignment is 50%.

### Learning outcomes

After successfully completing this subject, you will be able to:

a. Evaluate the steps engaged in a disciplined approach to problem-solving, algorithm development and coding,
b. Demonstrate and analyze elements of a good programming style,
c. Interpret and apply algorithms and program code,
d. Recognize, isolate and correct the errors, and analyzes the corrections in all phases of the programming progress,
e. Implement sound program analysis, coding, design, testing and debugging and techniques of documentation to simple programming problems,
f. Implement and justify the concept of object orientation as an approach to data abstraction,
g. Compare and contrast elements of the procedural and object-oriented programming approaches,
h. Write code in an applicable coding language.

### Pass requirements

A student must achieve minimum 50% in both the examination and the total mark to pass this subject.

There are total four tasks in this assignment. Those are:

 S.N. Title Value 1. Assignment 1 10% 2. Assignment 2 15% 3. Assignment 3 15% 4. Weekly Topic Quizzes 10%

A University of Australia has initiated an IT project, SACS- Shape Area Calculation System for enabling the math teaching in primary schools in Australia. For this project, the university has employed you to write a program in Python that will ask a user to chose a shape and enter the parameters linked to the selected shape, one by one.

A lecturer is expected to first choose a shape from six candidate shapes; Rectangle, Triangle, Circle, Trapezoid, Ellipse, and Parallelogram. Enter a mark out of 100 for all assessment tasks. The program should display the chosen shape and ask the user for the associated parameters (floating-point numbers) for calculating the area. As the area has been calculated, the program should correctly display the area (a floating point value with 2 decimal places) for the user. For illustration, if a user selects ‘Rectangle’ and enters ’32.5’ and ’21.0’ as the length and width of the rectangle, the program should be able to display an area of ‘682.50’ for the user.

Your program should be able to handle some exceptions like undefined shapes, invalid inputs, and invalid edge relationship of shapes.

A typical example of the display of your program can be as follows. Your program MUST follow the same display style.

-----------------------------------------------------------------------

Welcome to Shape Area Calculation System (SACS)

-----------------------------------------------------------------------

1. Triangle
2. Rectangle
3. Trapezoid
4. Circle
5.  Ellipse
6. Parallelogram

Please select the shape you would like to calculate the area for (1-6): 2

Thank you!

The shape you selected is: Rectangle

Please input the length (in centimeter): 32.5

Please input the width (in centimeter): 21.0

The area of the rectangle is 682.50 square centimeters.

Thanks for using Shape Area Calculation System!

Goodbye!

You need to develop the Shape Area Calculation System by completing the following three tasks:

Draw a flowchart that presents the steps of the algorithm required to perform the task specified. Some examples of flowcharts can be found at the following web links: https://www.programiz.com/article/flowchart-programming  http://users.evtek.fi/~jaanah/IntroC/DBeech/3gl_flow.htm

There are tools (see links below) that can be useful in drawing a flowchart. However, you can draw the flowchart/s with a pen/pencil on a piece of paper and scan it for submission. Please ensure that the scanned file and your handwriting are clear and legible.

https://www.draw.io/
http://dia-installer.de/
https://pencil.evolus.vn/

Select three 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 two sets of test data that will demonstrate the 'abnormal' operation of your program.

Set it out in a tabular form as follows: test data type, test data, the reason it was selected, the output expected due to using the test data, and finally a screenshot of the output actually observed when the test data is used. It is important that the output listings (i.e., screenshots) are not edited in any way.

 Test Data Table Test data type Test Data The reason it was selected The output expected due to the use of the data The screenshot of actual output when the test data is used Normal Normal Normal Abnormal Abnormal

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.

A University of Australia has initiated another IT project for AGoS- Automatic Grading of Students. The university has employed you to write a program in Python that will help the lecturer to automatically calculate the final marks for the students.

The program requires using the weights to calculate the weighted marks for the assessment items and the final mark for the subject. Note that the weight marks and the final marks are floating-point numbers with one decimal place. The program should then display the weightage mark of each individual assignment, the total weighted mark of the assignments, weighted mark for the final exam and total weighted mark of the subject. The weighted mark is calculated by multiplying the obtained mark and the weight of the assessment task. For instance, if a student gets 70 out of 100 in assignment 1 then their weighted mark in the assignment will be 70*20/100 = 14.0. After calculating the weighted mark, the system will continue to calculate the bonus marks for a subject depending on the total weighted marks in the subject. It follows the below-mentioned table to award bonus marks to a student.

 Bonus Policy Table Between 0 and 50 Nil Greater than 50, but less than or equal to 70 10% of every mark above 50 Greater than 70, but less than or equal to 90 2 marks PLUS 15% of every mark above 70 Greater than 90, but less than or equal to 100 5 marks PLUS 20% of every mark above 90

For instance, if a student gets the total weighted mark of 80 then the student gets a bonus mark of 3.5. Therefore, the final mark will be bonus mark then their total mark is set to be 100. After calculating the marks for a student, the system will allow the lecturer to enter details and marks for another student as before. If ‘N’ is entered, the program terminates, if not it will ask the same question again.

A representative illustration of the display of your program can be as follows. Your program must follow the following display style:

-----------------------------------------------------------------------------------------

The Innovation University of Australia (IUA) Grade System

-----------------------------------------------------------------------------------------

Please enter the student ID: 123456

Please enter the student Name: Alice Furner

Please enter all marks out of 100.

Please enter the marks for Assignment 1: 80

Please enter the marks for Assignment 2: 90

Please enter the marks for the Final Exam: 74

Thank You!

Weighted mark for Assignment 1: 16.0

Weighted mark for Assignment 2: 27.0

Total weighted mark of the assignments: 43.0

Weighted mark for the Final Exam is: 37.0

Total weighted mark for the subject: 80.0

Bonus mark: 3.5 Total mark with bonus: 83.5

Do you want to enter marks for another student (Y/N)? Y

Please enter the student ID: 111222

Please enter the student name: Bob Siers

Please enter all marks out of 100.

Please enter the marks for Assignment 1: 68

Please enter the marks for Assignment 2: 68

Please enter the marks for the Final Exam: 92

Weighted mark for Assignment 1: 13.6

Weighted mark for Assignment 2: 20.4

Total weighted mark of the assignments: 34.0

Weighted mark for the Final Exam: 46.0

Total weighted mark for the subject: 80.0

Bonus mark: 3.5 Total mark with bonus: 83.5

Do you want to enter marks for another student (Y/N)? N

Goodbye.

Your program should be able to handle invalid inputs like negative marks, not-a-number marks for marks greater than 100.

You need to develop the grading system by completing the following these tasks:

Draw flowchart/s that present the steps of the algorithm required to perform the task specified.

Choose three sets of test data that will show the ‘normal’ operation of your program; that is, test data will demonstrate what happens when a ‘Valid’ input is entered. Select two sets of test data that will show the ‘abnormal’ operation of your program.

Set out it in a tabular form as follows: test data, test data type, the reason it was selected, the output expected due to using the test data, and finally the output actually observed when the test data is used. It is vital that the output listings are not edited in any way.

 Test Data Table Test data type Test Data The reason it was selected The output expected due to the use of the data The screenshot of actual output when the test data is used Normal Normal Normal Abnormal Abnormal

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 test data table above.

This task is designed to support topic material related to decision structures and Boolean logic.

To complete this task, you’re required to develop a simple Soccer Player Management and Visualization System. The system is based on the European Soccer Database on Kaggle which is a platform for predictive modeling and analytics competitions based on the datasets uploaded by companies and users. The soccer player database has been reprocessed and saved in the Players.txt file. The first line of the file includes the attribute name: ‘Player ID’, ‘Play Name’, ‘Height’, and ‘Weight’ and each following line include a record for a player.

The system allows a user to add, search and visualize the players’ details. The major program should first display a menu as follows. A user requires to choose an operation from the main menu.

=======================================================

Welcome to the Soccer Player Management and Visualisation System

<A>dd details of a player.

<S>earch student details for a player.

<V>isualize student details.

<Q>uit.

=======================================================

Please select an option from the above:

If a user select the option <A> then the program asks them to enter a player’s ID, name and age, height and weight one by one. Once all details for a player are entered it will display player ID, name, age, height and weight. Later on, the details of the player are added to the end of the Players.txt. Note that the player ID should not be the same as those already is present in the text file and the format of the recently added record should be constant with that of current records.

Once the new record has been added, then the system will ask the user ‘Do you want to enter details for another player (Y/N)?’ if they enter ‘Y’ the system will allow them to enter details for another student as before, or if they enter ‘N’ the system will display the main menu again, otherwise, it will ask the same question again.

A typical example of the display of the program (once a user chooses the option <A>) can be as below mentioned. Your program must follow the same display style.

Please enter the player ID: 000011000

Please enter the player name: Lionel Messi

Thank You!

The details of the player you entered are as follows:

Player ID: 000011000

Player name: Lionel Messi

Age: 30

Height: 169

Weight: 72.0

The record has been successfully added to the Player.txt file.

Do you want to enter details for another plaer (Y/N)? N ================================================================= Welcome to the Soccer Player Management and Visualisation System

<A>dd details of a player.

<S>earch player details for a player.

<V>isualise player details.

<Q>uit. ================================================================= Please select an option from the above:

After the operation, the Players.txt file will have the following content after the details of Lionel Messi are entered.

If a user selects the option <S> from the main menu then the program asks the user to enter the player ID for whom they want to see details. To facilitate the search option you need to use an application data structure such as list. Then the gathers the player details from the Players.txt file and displays it as follows:

Please enter the player ID you want to search: 000011000

Thank You!

One player has been found:

Player ID: 000011000

Player name: Lionel Messi

Age: 30

Height: 169

Weight: 72.0

Do you want to search for another player (Y/N)? N

After displaying the player information the program prompts the user with the following message, ‘Do you want to search for another player (Y/N)?’ if a user enters ‘Y’ then the program asks them to enter the player ID for whom the information needs to be searched and displayed, else if the user enters ‘N’ then the program displays the main menu, otherwise, the program prompts the same message again. If a user selects the option <V> from the main menu, then the program asks to enter one attribute name from ‘Age’, ‘Height’, and ‘Weight’ for visualization.

1. Age
2. Height
3. Width

Please select the attribute you want to visualize: 1

For instance, if the user selects ‘Age’, the program will display the histogram of the ages of all the players. To show the histogram, you’ll need to use some 2D plotting libraries such as ‘Matplotlib’.

Note: you need to appropriately choose the bin number to avoid producing too-sparse or too-dense histograms.

After displaying the histogram, the program prompts the user with the following message, ‘Do you want to visualize for another attribute (Y/N)?’ if a user enters ‘Y’ then the program asks to select the attribute that needs to be visualized, else if the user enters ‘N’ then the program displays the main menu, otherwise the program prompts the same message again.

In the end, the program quits if the user selects the option <Q>.

Note: your program should be able to handle invalid inputs like ‘not-a-number or negative ages, heights, and weights’.

Draw flowchart/s that present the steps of the algorithm required to perform the task specified.

Choose 6 sets of test data that will show the ‘normal’ operation of your program, that is, test data that will show what happens when a valid input is entered. Choose 3 sets of test data that will show the ‘abnormal’ operation of your program.

Note: all the three features- Add, Search, and Visualize, should be tested.

Set it out in a tabular form as follows: test data type, test data, the reason it was selected, the output expected due to using the test data, and in the end the output actually observed when the test data is used. It is important that the output listings such as screenshots are not edited in any way.

 Test data type Test Data The reason it was selected The output expected due to the use of the data The screenshot of actual output when the test data are used Normal Normal Normal Abnormal Abnormal

Apply your algorithm in Python. Comment on your code as necessary to describe it clearly.

In addition to this exercise, use multiple functions, in place of using a single function to do everything. Make a decent design for the purposes to make the best use of the code and avoid duplicate calculations. For instance, you can have a function for calculating the weighted mark of an assignment and the function can be used for calculating all weighted marks. Avoid duplicate code.

Further, you also need to design your program so that it has components that can be reused in another program if needed. Handle exceptions properly. Use suitable data structure.

Run your program using the test data you’ve selected and completed the test data table above.