Question
Use Judge.java to complete the static methods which are described below. Each one gives a sample data you can utilize to write a test program.
Use Judge.java to complete the static methods which are described below. Each one gives a sample data you can utilize to write a test program. Main method in the in Judge.java or in JudgeTest.java. The underlinded method name in the class shows a static method. There will be no private data members.
Judge.java
/** * Develop a library of methods to analyze competition scores * from: * * @author **/
public class Judge { // max(): returns max score public static int max(int[] s ) {
} // min(): returns min score public static int min(int[] s ) {
} // valid(): returns number of valid scores // awarded(): returns the points awarded give scores and difficulty // compareTo(): returns indicator of relative performance of competitors }
Judge + max(s:intl) int + min s:intl) int + valids:intl, minScore:int, maxScore:int):int +swarded s:intl, d:double):double + compare Tos1:intll. d1:double, s2:int. d2:double):int public static int min int s) Description -Example - Recommendation Parameter s represents the scores assigned by judges for a competitor's performance. The method returns the minimum score. Suppose the scores are 6, 5, 2, 6, 7, 2, and 5, the method retuns 2 Make a valid guess of min score Compare all scores to the guess, whenever the guess is wrong update it . public static int max( ints) Parameter s represents the scores assigned by judges for a competitor's performance. The method returns the maximum score. Suppose the scores are 6, 5, 2, 6, 7, 2, and 5, the method returns T. Make a valid guess of max score Example . Recommendation Compare all scores to the guess, whenever the guess is wrong update it . public static int valid int s, int a, int b) Parameter s represents the scores assigned by judges for a competitor's performance; parameters a and b represent respectively the minimum and maximum possible scores. The method returns the number of valid scores Suppose the scores are 1, 5, 0, 6, 7, 2, and 5, and that the minimum possible score is 1 and the maximum possible score is 6. Because two of the seven scores are invalid, the method retums 5. Example public static double awardedf int s, double d . Parameter s represents the scores assigned by judges for a competitor's performance, parameter d represents the degree af difficulty for the compelitor's activity. The points awarded to the compelitor are gotten by first removing from consideration a high score and a low score. The remaining scores are averaged. The points awarded are the average multiplied by the degres of difficuity s Example Suppose the scores are 8, 9, 10, 7, 10, 7, and 8, and that the degree of difficulity is 21. Ignoring a high score and low score leaves scores& 9, 10, 7, and 8. Their average is 8.4 The points awarded are 8.4 times 2.1, that is 17 64 Sum the scores and then subtract away the low score and high score. Average the kept scores Multiply average by degree of difficulty to get points . Return points public static int compareTo int s1, double d1, int s2, double d2) Compares the points gotten by compettor 1 and competitor 2 for their performance in an event. The scores and degree of dlifficulity for compettor 1's performance are respectively s1 and d1; the scores and degree of difficulty for competitor 2's performance are respectively $2 and d2. If competitor 1 gat less points, the method returns-1, if the competitor's got the same number of points, the method returns 0, otherwise the method returns1 Determine awards points for competitor 1 and competitor Compare points to detenmine, which value to returnStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started