In this assignment you will design and create a software system to simulate a diving competition between (at least) 5 divers. In the competition, each diver must complete a dive for which 7 judges separately award a score. Each judge’s score must be between 0 and 10 and it may be given as a decimal point value. To calculate a diver’s overall resulting score, it is necessary to remove the highest and lowest judges’ scores and then the remaining 5 values are used in a calculation for the diver’s score.
Dives can vary in their degree of difficulty, with the minimum degree of difficulty being 1.2 and the maximum is 4.8. To allow for this, the sum of the 5 judges’ scores is multiplied by the degree of difficulty of the dive. Finally so comparisons can be made with other dive competitions that use 5 judges., the modified score is multiplied by a factor of 0.6 (source: http://www.fina.org/project/docs/rules/rules_dA2.pdf).
Create a software system to run a diving competition and decide an overall winner. The winner is the diver with the highest overall computed score from the judges. Your software system will be implemented firstly as a command line based application and then you will create a GUI version to run a diving competition.
As described above, there are 2 types of persons involved in a diving competition: diving judges and diving competitors. All diving judges and diving competitors have four main things in common; they all have a first name, a family name, a gender (male or female) and a country they represent, which can be modeled by a class Person.
Step 1: Using UML Diagram 1 as a guide, create code for the class Person. Next copy and run the code for the driver class called TestPersons, which creates instances of class Person and tests all of its methods.
Step 2: Using UML Diagram 2 as a guide, create code for the class Diver and class DivingJudge. Next create a driver class called TestEveryOne, which creates instances of class Diver and class DivingJudge class and tests all of their respective methods. Additionally class TestEveryOne should create a single array to store instances of class Person, class Diver and class DivingJudge and the array should be printed out using a single for loop.
//*************************************************
// TestPersons.java Author: Anne Venables
// a driver class to create instances of class Person
// and test its methods
//*************************************************
public class TestPersons
{
public static void main(String [ ] args)
{ Person anne = new Person ( "Anne", "Venables", "Australia", 1) ;
Person dan = new Person ( "Dan", "Nelson", "USA", 0) ;
// testing all get methods
System.out.println( "First name is " + anne.getFirstName ( ) );
System.out.println( "Family name is " + anne.getFamilyName ( ) );
System.out.println( "Country is " + anne.getCountry ( ) );
// 0 for gender value represents male, else gender is female
System.out.print ("Gender is " );
if (anne.getGender( )==0)
System.out.println ( "male") ;
else
System.out.println ( "female") ;
// testing the set method and toString
anne.setCountry ("New Zealand") ;
System.out.println( anne );
// testing the equals method
System.out.println ( anne.equals (dan ) ) ;
// testing the equals method
System.out.println ( anne.equals (new Person ("Anne", "Venables", "New Zealand", 1) ) ) ;
}//end main
}//end class
Step 3: Once you have your classes organized and tested, you need to set up and run a diving competition for male competitors and female competitors. You should create extra classes to assist you in managing the details of the competition, including where the competition is run. There are several possible designs that you could adopt for your solution, each with varying strengths and weaknesses. Whichever way you design your software system, a typical printout from a run should look like the output on the next pages.
DIVING COMPETITION in Melbourne RESULTS
*************************************************
************ MALE COMPETITION *************
*************************************************
Bob Johnson Canada
diving with a degree of difficulty 2.1
...........................................................
receives scores from the following judges :
Anne Venables Australia awards a score of: 2.2
Raj Singh India awards a score of: 9.5
Trinh Nguyen Vietnam awards a score of: 1.7
John Smith England awards a score of: 3.6
Dan Nelson USA awards a score of: 2.4
Grace Tan Malaysia awards a score of: 2.9
Jakub Szajman Poland awards a score of: 3.4
TOTAL score awarded is: 14.5
FINAL RESULT awarded is: 18.3
------------------------------------------------------------
Janus Smidt Germany
diving with a degree of difficulty 3.3
...........................................................
receives scores from the following judges :
Anne Venables Australia awards a score of: 0.3
Raj Singh India awards a score of: 1.5
Trinh Nguyen Vietnam awards a score of: 5.1
John Smith England awards a score of: 9.8
Dan Nelson USA awards a score of: 5.6
Grace Tan Malaysia awards a score of: 1.7
Jakub Szajman Poland awards a score of: 1.2
TOTAL score awarded is: 15.1
FINAL RESULT awarded is: 29.9
------------------------------------------------------------
Xin Li China
diving with a degree of difficulty 2.2
...........................................................
receives scores from the following judges :
Anne Venables Australia awards a score of: 4.8
Raj Singh India awards a score of: 8.1
Trinh Nguyen Vietnam awards a score of: 5.6
John Smith England awards a score of: 7.2
Dan Nelson USA awards a score of: 5.0
Grace Tan Malaysia awards a score of: 6.7
Jakub Szajman Poland awards a score of: 0.4
TOTAL score awarded is: 29.3
FINAL RESULT awarded is: 38.7
------------------------------------------------------------
***********THE WINNER IS ***********
Xin Li
China
*************************************
...........................................................
receives scores from the following judges :
Anne Venables Australia awards a score of: 6.9
Raj Singh India awards a score of: 7.1
Trinh Nguyen Vietnam awards a score of: 8.1
John Smith England awards a score of: 8.3
Dan Nelson USA awards a score of: 8.3
Grace Tan Malaysia awards a score of: 9.5
Jakub Szajman Poland awards a score of: 2.9
TOTAL score awarded is: 38.7
FINAL RESULT awarded is: 99.8
------------------------------------------------------------
Martina Nava Slovenia
diving with a degree of difficulty 3.2
...........................................................
receives scores from the following judges :
Anne Venables Australia awards a score of: 7.8
Raj Singh India awards a score of: 6.7
Trinh Nguyen Vietnam awards a score of: 8.3
John Smith England awards a score of: 4.3
Dan Nelson USA awards a score of: 4.3
Grace Tan Malaysia awards a score of: 4.0
Jakub Szajman Poland awards a score of: 1.5
TOTAL score awarded is: 27.1
FINAL RESULT awarded is: 52.0
------------------------------------------------------------
***********THE WINNER IS ***********
Bing Tuan
Hong Kong
*************************************
Design a GUI application to set up and run a diving competition. The GUI needs to be able to:
The appearance of the GUI is entirely up to you to decide.
Feel free to add any extra features that you feel are useful. You may decide to use a JTabbedPane or layout managers not covered in lectures, such as CardLayout to organise the functions in your GUI. Check the text or the online Java documents for details