COIT20245 Introduction to Programming Assignment

Assignment Help JAVA Programming
Reference no: EM132526027

COIT20245 Introduction to Programming - Central Queensland University

1. Introduction

In this assignment, you are to implement a console applicationfor the management of a premiership table for an Australian Rules football league. The table will have the structure shown in Figure 1.

134_figure.jpg

Figure 1. Premiership table for the SANFL Women's League after Round 3

In this particular league, there are 8 teams, with names of your choosing- I recommend t1-t8. Also, the table displays team names only and not team icon + team name, as in Figure 1. Position in the table is determined on the basis of premiership points (points in Figure 1); teams with the same number of premiership points are ranked accordingto percentage. Premiership points are awarded for each game -2 to the winning team, 0 to the losing team and if the game is drawn, 1 to each team. As described in Assignment 1, the outcomeof a game is determined using the points scored by each team, where points = goals*6+behinds. The percentage for each team is calculated as follows:
percentage = scorefor / (score for + score against)
where
• score for is the total number of points scored by the team in all games played so far and
• score against is the total number of points that the opposing teams have scored in all games played so far
Note that in the AFL, the premiership points available per game and the way in which percentage is calculated are different, but the ranking process is the same. And what happens, if at the end of the season, two teams have the same number of premiership points, score for and score against? I don't know.

The Application
The current state of the premiership table is to be stored in 6 arrays, using array initialisers. E.g.
// The data is from a sorted table, so there is no need to sort the table
// once it is generated.The data is from the SANFL women's league, where
// scores are lower thanin the AFL. Also in the SANFL, premiership
// points and percentages are calculated differently to the AFL.
String teams[] = {"t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8"};
int wins[] = {3, 3, 2, 1, 1, 1, 1, 0};
int losses[] = {0, 0, 1, 2, 2, 2, 2, 3};
int drawn[] = {0, 0, 0, 0, 0, 0, 0, 0};
intscoreFor[] = {149, 127, 105, 90, 85, 60, 50, 81};
intscoreAgainst[] = {50, 59, 65, 104, 118, 107, 150, 94};

Note that not all columns in Figure 1 are present. Team position is determined from its index in the arrays (add 1 to the index). The remaining columns can be derived from the above data.
The raw data is to be used to create objects of type Entry, which are to be stored in an array of type Entry. The Entry class is to conform to the class shown in the UML Diagram of Figure 2 .Note that in Figure 2, the visibility of class methods and attributes are designated as + (public) and - (private). Associations are annotated with a label (for readability) and multiplicity. The multiplicity captures the number of object instances that can be involved in the association. In this case, only two values apply - 1 and *, which means many.
Creation of the Entry array is to occur when the Table object is created, using a private method called load(). This method will iterate through the 6 arrays that define the current state of the table, construct Entry objects and add them to the entry array.As befitting a premiership table, the data array is ordered on position, as in Figure 1. When the table is updated, the table will need to be sorted. As noted in Section 1, this will require sorting on two attributes -the primary attribute ispremiership points and the secondary attribute ispercentage. The easiest way to do this is to define a compare function:
private int compare(Entry e1, Entry e2) {
// Returns
// -1 if e1 < e2
// 0 if e1 == e2
// +1 if e1 > e2
}

Your (private) sort method must implement selection sort.
The application's Controller classis to execute (using a switch statement) the following command options:
1. Display available commands
2. Display current table
3. Display selected statistics
4. Display the entry for a specified team
5. Display entries for teams with the same points as a specified team
6. Add a new result
7. Exit the application

For 3, the statistics to be generated are

In the unlikely event that two or more teams have the highest score for or the lowest score against, just return the first of the teams.
For 6, the premiership table must be updated

1252_figure1.jpg

Figure 2. Class Diagram

As it is a console application, the user will need to be prompted to enter a command and its arguments (if any). My personal preference is for a minimal interaction scheme, as shown below:

run:

Available commands are:

       help                                             0

       display entries                                  1

       display selected statistics                      2

       lookup a specified team                          3 team

       find teams with same points as a specified team  4 team

       add a new result                                 5 team1 g1 b1 team2 g2 b2

       quit                                             9

> 3 t4

Pos    Team   Played Points %      Won    Lost   Drawn  PF     PA

4      t4     2      2      48.8   1      1      0      59     62

 

Feel free to adopt the above scheme or if you prefer, implement a more verbose interaction scheme.
Note that
1. Each command is designated a number
2. The command options are displayed at the start of the application and whenever a "help" command is entered, rather than after each command.
3. Percentages are to be displayed to 1 decimal point
For the commands that require arguments
1. For commands 3, 4 and 5, an error message must be displayed if a specified team is not in the table. No other data validation is required.
2. The application must conform to the class diagram of Figure 2, although additional private members and private methods are permitted.

Attachment:- Introduction to Programming.rar

Reference no: EM132526027

Questions Cloud

Risk and audit management : How is corporate IT governance different from the usual practice? What are the elements of risk analysis?
Provide all the journal entries for jared corporation : Provide all the journal entries in 20x3 and 20x4.In January 20x4, Jared incurred 9,000 of legal fees in a successful defense of its patent.
Applications of the stream cipher and the block cipher : Examine the different types of applications of the stream cipher and the block cipher.
How much is the gain on disposal recognized in andre co : How much is the gain(loss) on disposal recognized in Andre Co.'s statement of profit or loss? Andre Co. Was granted a patent on January 1, 20x1.
COIT20245 Introduction to Programming Assignment : COIT20245 Introduction to Programming Assignment Help and Solution, Central Queensland University - Assessment Writing Service
Blockchain-big data-government and policies : Explain the major components of blockchain. Be sure to include how blockchain is affecting a global economy and how you see it growing in the future.
Has been any goodwill on the acquisition : Has there been any goodwill on the acquisition? Or any gain on bargain purchase? Where would you find it in the financial statements
What are the risks of bias : What are the risks of bias and how concerned should financial managers be about bias in the process of valuation and equity research?
Interesting assignments : Interesting Assignments - What were some of more interesting assignments to you?. Interesting Readings - What reading or readings did you find most interesting

Reviews

Write a Review

JAVA Programming Questions & Answers

  Find the value of the optimal plan

Design a dynamic programming algorithm to find the value of the optimal plan. Implement your algorithm using any programming language you prefer.

  What is method overloading

1. What is method overloading? 2. What is the purpose of a constructor? 3. How do you call a method of one class from a method of another class?

  Java enumeration lettergrade represent letter grades

Write a java enumeration LetterGrade that represents letter grades A through F, including plus and minus grades. Define a private instance variable holding a boolean value.

  Write a program that reads a set of floating-point values

Write a program that reads a set of floating-point values. Ask the user to enter the values.

  Repackaging android apps to disclose sensitive information

Repackaging Android apps to disclose sensitive information. Why is the repackaging attack not much a risk in iOS devices

  Overriding the equals method

Use the equals method, which Player inherits from the Object class, to determine whether two players are the same. Are the results what you expect?

  Write a recursive method called maxsum

write a recrusive method called maxSum that accepts a list of integers. L, and an integer limit n as parameters and use backtracking to find the maximum sum that can be generated by adding elements of L that do not exceed n.

  Create a swing based java gui application

COIT11134 - Object Oriented Programming(T12017) This assignment is designed to test the ability in defining superclass, subclasses and creating & using objects in addition to designing Graphical User Interface (GUI).

  Create class account with id balance person and datecreated

Create class Account with id, balance, Person, and dateCreated. Use a static class variable to store the annualInterestRate for all account holders. Provide constructors, setter and getter for the Account class.

  Implement the socket program

implement encryption functionality in your code, especially in regard to data in transit i.e. network communications - written in the Java programming language

  Define an abstract class called staff

Define an abstract class called Staff with the following fields and methods: Fields: name, id, position representing the name, staff id and the position.

  Create a program that will simulate the child''s number guess

Create a program that will simulate the child's number guessing game with two players

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd