Practice java programming with GUI, Collections, Lambda and swings.
Task 1: (5 marks)
In an Olympic unknown competition, a few teams (for example 12 teams or
countries) qualified for the final. The interactions and displays are simple:
When we click a country, for example France; its ranking will be displayed
in the frame, and the detailed final ranking with the scores will be displayed
in another panel.
You can continue to click all the countries to see the ranking of all countries
in the left frame:
Let us now explore the UML diagram for this task:
In the class Olympic, you have an important instance variable which is the
name of the country. Each country receives an array of scores (the size is
NO, a constant, as specified in the class; the scores given by the judges) and
also a final ranking which will be updated later in the design.
When constructing an object of class Olympic, you only need pass in the
country name. The processScores method is to generate some scores (upon
100) for each judge.
The class OlympicFrame designs your GUI. You construct a list of Olympic
objects and determine the ranking.
A few important methods in the class OlympicFrame:
– The getFinalRanking constructs and returns a string that you can
display this string in the panel.
– The getCountry method returns the country name that has rank n.
– The getScores method returns the total scores of a country.
Note that this assignment emphasizes on modular design, object-oriented
designs, and a bit of functional programming with lambda expressions in
Put all your classes in a file called YourName_A3.java and make sure
that this file can be compiled and can be executed. Upload ONLY this file
to Moodle. ALL ZIP FILE SUBMISSION WILL BE REJECTED
No re-submission will be allowed after grading.
In the above file, remember to put down your name and the following
declaration (some similar contents):
// Tell me if it is your own work, and whether you have passed your
// program to your friends etc etc etc
// and willing to accept whatever penalty given to you.
– Wrong file name -0.5 mark
– No declaration, no name etc -1 mark
– Failing to demo -1 mark
– Programs indentations and alignment of statements -0.5 mark
– Late penalty: -0.1 mark per hour