A Sports Management Application is required to process the results of sports competitions (e.g. Asian Youth Games).
You are assigned to develop a simple Java program to demonstrate the functions provided by the system.
A sample of the result of a sports competition shown in Figure 1 below:
Country Gold Silver Bronze
China 25 16 11
Hong Kong 5 8 5
India 5 3 3
Japan 5 6 4
Korea 20 17 17
Kuwait 3 3 5
Singapore 9 6 15
Thailand 11 7 2
Figure 1 – Medal Tally Table
The assignment consists of “Basic Requirements” and “Additional Requirements” as described in sections 3 and 4 respectively. You MUST complete the basic requirements BEFORE proceeding with the additional requirements.
For this assignment, you are expected to do the following :
• carry out proper problem analysis and program design before you start coding your program;
• break your program into smaller and simpler parts;
• implement and test a part at a time;
• use methods where appropriate.
The required resources for this assignment are:
J2se 1. 5 (or higher version)
JGrasp 1.8.5 (or higher version)
3. BASIC REQUIREMENTS
The system should provide the following basic features:
● Display result
To allow the user to view all the countries and their medals
● Enter the result
To allow the user to update the result each time an event has completed
● Display countries which have achieved a given number of gold medals
To allow the user to view the countries which have achieved a given number of gold medals
● Find the country with the most gold medals
To allow the user to view the country with the highest number of gold medals
● Find the country with the least gold medals
To allow the user to view the country with the lowest number of gold medals
● Validation (and feedback)
The program should handle all invalid entries by the user, e.g. invalid numeric data. If user made a mistake in the entry, the program should inform the user via appropriate feedback.
Please refer to the sample screen-shots below for more details
5. Sample Screen Shots
Main Menu
When the program is run, it should display the main menu as shown below.
Main Menu
[1] Display result
[2] Enter result
[3] Display countries with a given number of gold medals
[4] Find country with most gold medals
[5] Find country with least gold medals
[0] Exit
Enter your option : _
Figure 2 - Main Menu
When a user enters an option from 1 to 5, the program will process the option. After the option has been processed, the program will display the main menu again.
If the user chooses option 0, the program will terminate.
Option 1 : Display Result
If the user chooses option 1, all the countries and their medals will be displayed as shown below.
NO Country Gold Silver Bronze Total
1 China 25 16 11 52
2 HongKong 5 8 5 18
3 India 5 3 3 11
4 Japan 5 6 4 15
5 Korea 20 17 17 54
6 Kuwait 3 3 5 11
7 Singapore 9 6 15 30
8 Thailand 11 7 2 20
Figure 3 – Display Result
Option 2 : Enter Result
If the user chooses option 2, the system should display the list of countries and prompt the user to enter the countries that has won the gold, silver and bronze medal as shown below., and update the data accordingly.
NO Country
---------------------------------
1 China
2 Hong Kong
3 India
4 Japan
5 Korea
6 Kuwait
7 Singapore
8 Thailand
---------------------------------
Gold Medal : Select country : 7
Silver Medal : Select country : 3
Bronze Medal : Select country : 8
The result has been updated.
Figure 4 – Enter Result
Option 3 : Display countries which have achieved a given number of gold medals
If the user chooses option 3, the user will be prompted to enter a number as shown below.
Enter number of gold medals : 10
Countries with 10 or more gold medals are:
NO Country Gold Silver Bronze Total
1 China 25 16 11 52
2 Korea 20 17 17 54
3 Thailand 11 7 2 20
Figure 5 – Countries with given number of gold medals
Option 4 : Find the country with the most gold medals
If the user chooses option 4, the system will find and display the country with the most gold medals as shown below.
The country the most gold medals is : China
Figure 6 – Country with most gold medals
Note : If more than one countries have the same gold medals, only one of them needs to be displayed.
Option 5 : Find the country with the least gold medals
If the user chooses option 5, the system will find and display the country with the least gold medals as shown below.
The country with the least gold medals is : Kuwait
Figure 7 – Country with least gold medals
Note : If more than one countries have the same gold medals, only one of them needs to be displayed.