Starting from:

$30

BBM104-Quiz 3 Inheritance, Polymorphism Solved

Write an object oriented program that creates the standing tables from the given all matches result separately of the Ice Hockey and Handball sports.

 

1.1 Information about the sports • In Ice Hockey, in which three points are awarded to the team winning a match, with no points awarded to the losing team. If the game is drawn, each team receives one point. • In Handball, in which two points are awarded to the team winning a match, with no points awarded to the losing team. If the game is drawn, each team receives one point. • If two or more teams are on the same number of points. The number of goals scored against a team is subtracted from the number of goals it has scored itself. The bigger the goal difference, the better.

1.2         Restrictions
•    You must implement your codes by using inheritance and polymorphism.

•    There are 4 teams in each sport type.

•    The initial scores of the 4 teams in each sport type are zero. • Since each group has 4 teams separately, there will be 6 match totally in each group. Therefore, there are 12 match (fixed 12 lines) totally in fixtures.txt

 

1

1.3         Sample Input and Outputs
•    Sample input file named as fixtures.txt:

[First letter of sport]tab[name of first club]tab[name of second club]tab[match result]newline

 

•    Sample output files.

[ranking.]tab[name of club]tab[number of played matches]tab[number of matches won ]tab[match with an even score or tie]tab[number of matches loss ]tab[number of sets For:the number of sets Against ]tab[total points]newline
•    handball.txt is as shown below:

 

Figure 2: handball.txt

•    icehockey.txt is as shown below

 

Figure 3: icehockey.txt

•    You are expected to write the output of your program to a text file named type of sport.txt for each type of sport. (for example: icehockey.txt, handball.txt.)

•    The explanation of the standing table columns for each sport types are as follows:

–    First column defines the ranking

–    Second column defines the club name

–    Third column defines the number of played matches

–    Fourth column defines the number of matches won

–    Fifth column defines the number of times a team has finished a match with an even score or tie

–    Sixth column defines the number of matches loss

–    Seventh column defines the number of sets For : the number of sets Against

–    Eighth column defines the total number of points earned

2           How to run your program
The input file is going to be given as program argument. In order to test your program, you should follow the following steps:

•    Upload your java files to your server account (dev.cs.hacettepe.edu.tr)

•    Compile your code (javac *.java) • Run your program (java Main fixtures.txt)

•    Control your output data and format.

More products