Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this java question - Example: 7.0+7.5+7.5=22.0 Multiply by the degree of difficulty (DD). Each attempted dive has a degree of difficulty calculated

Need help with this java question

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

- Example: 7.0+7.5+7.5=22.0 Multiply by the degree of difficulty (DD). Each attempted dive has a degree of difficulty calculated in advance. This is based on many factors, such as the number of twists and somersaults and the take-off and entry positions. Multiply your last sum by the degree of difficulty to get the final score for this dive. - Example: Let's say the diver attempted an inward 21/2 somersault dive in the 10 meters competition, in the pike position. This has a difficulty score of 2.8. Multiply this by the execution score to get the final score: 22.0x 2.8=61.6. Note that the degree of difficulty has only one decimal point, i.e., *.\# (* is 1,2,3,4, very seldom 5 , \# is 0 to 9 ). In a competition, divers need to dive a few rounds, normally 5 rounds. The degrees of difficulty, for each round, are usually pre-determined before the beginning of the competition. Let us look at a simple UML diagram for this assignment: Two important classes: Country class, Diving class; and a main class that we will define it later. Convenient to your design, additional class(es) is / are allowed. Let us now look at the detail of each class. Basically each class has private instance variables, constructors, accessor methods, mutator methods and some other methods 2 related to the class(es). Methods are either public or private; instance variables must be private. Let us start with the Country class: It consists of four private instance variables: name (of a country), player (name of a player), age (of the player) and dArray (an array of difficulty). A constructor to initialize the instance variables, some accessor methods, a mutator method and a display info method. Additional methods are allowed. Additional instance variables or any change to instance variables are not allowed. Usually a player participates in a diving competition, he / she needs to declare the level of diving difficulties before the competition. The competition usually consists of 5 rounds. This array stores 5 real number representing the degree of difficulties of each round. The display Info method displays the info of a participant, for example, Thailand Name 2 15 2.12.52.64.4 4.5 Note that this array (dArray) is "pre" sorted before comstructing a Country object. Next, let us look at the Diving class which is the most important class of this assignment: This class has a constant SIZE indicating the number of judges, usually is 7 . It consists of 5 instance variables: name (a Country object), score (an array, scores given by judges), difficulty (level of difficuly of each dive), cf (carried forward derived from the previous round, obviously round 1 has no carried forward score, i.e. 0 and fs (the final score of the current round). Most of the methods are obvious in definition. The getSortedList stores the stores the scores in a list (a dummy list) and sort it; you can use it to retrieve the highest, second highest etc. scores. This method is optional, you can find your own way to solve the problem. The display info method displays the result of a participant according to the following format: (you will see order of printing during the runtime interactions and displays): Thasland .5 8,6 3.50.59.68.58.82.1 8. 6 25,20 25.26 Now our main class to drive the whole application. Let us look at the UML diagram: We define a constant to store the number of rounds for a competition. I may ask you to change the value of this constant during demo; just make sure that you produce a general design. We define a string array of countries (Countries) to be used in the design. A country can send more than one participant. We usually use, for example, China 1, China 2 if China sends two participants. A few important tasks to be done in the main class. Let us look at the runtime interactions and display before we look the methods used in the main class: Upon execution, the system firstly displays the information of each participant: Now, the display of round 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

Students also viewed these Databases questions

Question

=+ What would it look like? Who should deliver it?

Answered: 1 week ago