COIT20245 - Introduction to Programming: Football Statistics in Java

Verified

Added on  2022/09/26

|11
|1629
|15
Homework Assignment
AI Summary
This Java program is designed to analyze Australian Rules Football games, taking input for each team's goals and behinds to determine the winner. The program calculates the total points for each team, considering a goal worth six points and a behind worth one point. It identifies the winning team based on the highest score and designates a draw if both teams have equal points. The application processes data for five games, generating statistics such as the biggest, smallest, and average margin of victory. The solution also includes test cases with expected and actual outputs to validate the program's functionality. The program's limitations are noted, such as the lack of user input validation and potential errors in identifying the biggest margin in certain scenarios. This assignment aims to demonstrate a basic understanding of Java programming principles, conditional statements, and simple calculations within the context of a sports analysis application.
Document Page
Running Head: INTRODUCTION TO PROGRAMMING
Introduction to Programming
Name of the Student
Name of the University
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1INTRODUCTION TO PROGRAMMING
Limitations
1. In this java programming, there is no user input validation done, so if the user gives
string value instead of an integer, then the program throws an error message.
2. In this program, if the first match margin is greater than any other match margin, then
the program generates a wrong biggest margin in some cases. The problem mentioned
above can be resolved by the use of an array.
Test plan
Test
Case
Input Expected Output Actual Output
1 Game 1 of 5
t1 10 15 t2 12 3
Game 2 of 5
t3 20 8 t4 20 10
Game 3 of 5
t5 13 7 t6 12 12
Game 4 of 5
t7 11 11 t8 11
17
Game 5 of 5
t9 20 3 t10 15 9
t1(10 goals,15 behinds) t2(12
goals,3 behinds)
Match drawn: Match rating = 4
t3(20 goals,8 behinds) t4(20
goals,10 behinds)
t4 won by 2 points: Match rating = 4
t5(13 goals,7 behinds) t6(12
goals,12 behinds)
t5 won by 1 points: Match rating = 4
t7(11 goals,11 behinds) t8(11
goals,17 behinds)
t8 won by 6 points: Match rating = 4
t9(20 goals,3 behinds) t10(15
goals,9 behinds)
t1(10 goals,15 behinds) t2(12 goals,3
behinds)
Match drawn: Match rating = 4
t3(20 goals,8 behinds) t4(20 goals,10
behinds)
t4 won by 2 points: Match rating = 4
t5(13 goals,7 behinds) t6(12 goals,12
behinds)
t5 won by 1 points: Match rating = 4
t7(11 goals,11 behinds) t8(11 goals,17
behinds)
t8 won by 6 points: Match rating = 4
t9(20 goals,3 behinds) t10(15 goals,9
Document Page
2INTRODUCTION TO PROGRAMMING
t9 won by 24 points: Match rating =
3
Summary
Biggest margin was 24
Smallest margin was 0
Average margin was 6
behinds)
t9 won by 24 points: Match rating = 3
Summary
Biggest margin was 24
Smallest margin was 0
Average margin was 6
2 Game 1 of 5
t1 6 5 t2 3 4
Game 2 of 5
t3 15 8 t4 9 10
Game 3 of 5
t5 13 7 t6 12 13
Game 4 of 5
t7 11 10 t8 14 6
Game 5 of 5
t9 7 10 t10 9 7
t1 (6 goals ,5 behinds) t2 (3 goals,4
behinds)
t1 won by 19 points: Match Rating:
3
t3 (15 goals ,8 behinds) t4 (9
goals,10 behinds)
t3 won by 34 points: Match Rating:
1
t5 (13 goals ,7 behinds) t6 (12
goals,13 behinds)
Match drawn: Match Rating: 4
t7 (11 goals ,10 behinds) t8 (14
goals,6 behinds)
t8 won by 14 points: Match Rating:
3
t9 (7 goals ,10 behinds) t10 (9
goals,7 behinds)
t10 won by 9 points: Match Rating:
3
t1 (6 goals ,5 behinds) t2 (3 goals,4
behinds)
t1 won by 19 points: Match Rating: 3
t3 (15 goals ,8 behinds) t4 (9 goals,10
behinds)
t3 won by 34 points: Match Rating: 1
t5 (13 goals ,7 behinds) t6 (12 goals,13
behinds)
Match drawn: Match Rating: 4
t7 (11 goals ,10 behinds) t8 (14 goals,6
behinds)
t8 won by 14 points: Match Rating: 3
t9 (7 goals ,10 behinds) t10 (9 goals,7
behinds)
t10 won by 9 points: Match Rating: 3
Summary
Biggest margin was 34
Smallest margin was 0
Average margin was 15
Document Page
3INTRODUCTION TO PROGRAMMING
Summary
Biggest margin was 34
Smallest margin was 0
Average margin was 15
3 Game 1 of 5
t1 9 8 t2 12 4
Game 2 of 5
t3 5 6 t4 7 8
Game 3 of 5
t5 11 4 t6 10 12
Game 4 of 5
t7 8 4 t8 7 10
Game 5 of 5
t9 7 10 t10 9 7
t1 (9 goals ,8 behinds) t2 (12 goals,4
behinds)
t2 won by 14 points: Match Rating:
3
t3 (5 goals ,6 behinds) t4 (7 goals,8
behinds)
t4 won by 14 points: Match Rating:
3
t5 (11 goals ,4 behinds) t6 (10
goals,12 behinds)
t6 won by 2 points: Match Rating: 4
t7 (8 goals ,4 behinds) t8 (7 goals,10
behinds)
Match drawn: Match Rating: 4
t9 (7 goals ,10 behinds) t10 (9
goals,7 behinds)
t10 won by 9 points: Match Rating:
3
Summary
Biggest margin was 14
Smallest margin was 0
t1 (9 goals ,8 behinds) t2 (12 goals,4
behinds)
t2 won by 14 points: Match Rating: 3
t3 (5 goals ,6 behinds) t4 (7 goals,8
behinds)
t4 won by 14 points: Match Rating: 3
t5 (11 goals ,4 behinds) t6 (10 goals,12
behinds)
t6 won by 2 points: Match Rating: 4
t7 (8 goals ,4 behinds) t8 (7 goals,10
behinds)
Match drawn: Match Rating: 4
t9 (7 goals ,10 behinds) t10 (9 goals,7
behinds)
t10 won by 9 points: Match Rating: 3
Summary
Biggest margin was 14
Smallest margin was 0
Average margin was 7
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4INTRODUCTION TO PROGRAMMING
Average margin was 7
4
Game 1 of 5
t1 9 10 t2 11 5
Game 2 of 5
t3 18 5 t4 15 12
Game 3 of 5
t5 11 4 t6 10 10
Game 4 of 5
t7 14 8 t8 9 10
Game 5 of 5
t9 21 8 t10 15 9
t1 (9 goals ,10 behinds) t2 (11
goals,5 behinds)
t2 won by 7 points: Match Rating: 3
t3 (18 goals ,5 behinds) t4 (15
goals,12 behinds)
t3 won by 11 points: Match Rating:
3
t5 (11 goals ,4 behinds) t6 (10
goals,10 behinds)
Match drawn: Match Rating: 4
t7 (14 goals ,8 behinds) t8 (9
goals,10 behinds)
t7 won by 28 points: Match Rating:
1
t9 (21 goals ,8 behinds) t10 (15
goals,9 behinds)
t9 won by 35 points: Match Rating:
1
Summary
Biggest margin was 35
Smallest margin was 0
Average margin was 16
t1 (9 goals ,10 behinds) t2 (11 goals,5
behinds)
t2 won by 7 points: Match Rating: 3
t3 (18 goals ,5 behinds) t4 (15 goals,12
behinds)
t3 won by 11 points: Match Rating: 3
t5 (11 goals ,4 behinds) t6 (10 goals,10
behinds)
Match drawn: Match Rating: 4
t7 (14 goals ,8 behinds) t8 (9 goals,10
behinds)
t7 won by 28 points: Match Rating: 1
t9 (21 goals ,8 behinds) t10 (15 goals,9
behinds)
t9 won by 35 points: Match Rating: 1
Summary
Biggest margin was 35
Smallest margin was 0
Average margin was 16
5 Game 1 of 5
t1 6 10 t2 5 4
t1 (6 goals ,10 behinds) t2 (5 goals,4
behinds)
t1 (6 goals ,10 behinds) t2 (5 goals,4
behinds)
Document Page
5INTRODUCTION TO PROGRAMMING
Game 2 of 5
t3 3 5 t4 0 12
Game 3 of 5
t5 9 4 t6 5 8
Game 4 of 5
t7 13 8 t8 9 8
Game 5 of 5
t9 17 3 t10 14 5
t1 won by 12 points: Match Rating:
3
t3 (3 goals ,5 behinds) t4 (0 goals,12
behinds)
t3 won by 11 points: Match Rating:
3
t5 (9 goals ,4 behinds) t6 (5 goals,8
behinds)
t5 won by 20 points: Match Rating:
3
t7 (13 goals ,8 behinds) t8 (9 goals,8
behinds)
t7 won by 24 points: Match Rating:
3
t9 (17 goals ,3 behinds) t10 (14
goals,5 behinds)
t9 won by 16 points: Match Rating:
3
Summary
Biggest margin was 24
Smallest margin was 11
Average margin was 16
t1 won by 12 points: Match Rating: 3
t3 (3 goals ,5 behinds) t4 (0 goals,12
behinds)
t3 won by 11 points: Match Rating: 3
t5 (9 goals ,4 behinds) t6 (5 goals,8
behinds)
t5 won by 20 points: Match Rating: 3
t7 (13 goals ,8 behinds) t8 (9 goals,8
behinds)
t7 won by 24 points: Match Rating: 3
t9 (17 goals ,3 behinds) t10 (14 goals,5
behinds)
t9 won by 16 points: Match Rating: 3
Summary
Biggest margin was 24
Smallest margin was 11
Average margin was 16
Document Page
6INTRODUCTION TO PROGRAMMING
Test results
Test Result 1
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7INTRODUCTION TO PROGRAMMING
Test Result 2
Document Page
8INTRODUCTION TO PROGRAMMING
Test Result 3
Document Page
9INTRODUCTION TO PROGRAMMING
Test Result 4
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10INTRODUCTION TO PROGRAMMING
Test Result 5
chevron_up_icon
1 out of 11
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]