Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a solution to this problem, I\'ve been trying, but my source code is a fa

ID: 3551284 • Letter: I

Question

I need a solution to this problem, I've been trying, but my source code is a failure and I don't know how to use arrrays well. Please use arrays, and explain what they do with a quick comment. Solve the extra credit too!


Specific Instructions:


A talent show competition has five (5) judges, each of whom awards a score between 0 and 10.

The scores allow floating-point number values, such as 8.5. A participants final score is

determined by eliminating the lowest and highest score (only one value, if there are duplicate

lowest/highest scores) and then averaging the remaining scores (number of judges, minus 2).

You are to implement a solution that implements the preceding requirements. You are to utilize

an array to store and process the judges scores. The solution must include the following

methods:


1. void getJudgeData(double[]): Obtain the scores for the five (5) judges. Call

method getJudgeScore() to obtain each judges score.


2. double getJudgeScore(int): Solicit and validate the score value for an individual

judge. You are to pass the judgeâs number as a parameter to the method. Do not

RETurn from the method until a valid value is entered. The RETurn value is the judge

score.


3. double calculateScore(double[]): Calculates and RETurns the average of the

judges scores after dropping one highest score and one lowest score received. This

method shall call the following two methods to determine the lowest and highest scores

received:


a. double findLowest(double[]): RETurns the lowest score received.

b. double findHighest(double[]): RETurns the highest score received.


-----------------------------------


Extra Credit (5 points):


Allow the User to determine the number of judges for the event. The number is to be restricted

between 5 and 9 judges, inclusive. You are to utilize the following method to obtain the number

of judges:


1. int nmbrJudges(): Prompt the User for the number of judges for the event. You must

validate the input value and not RETurn from

Explanation / Answer

Indented code can be found at:

https://dl.dropboxusercontent.com/u/42883368/chegg/CheggNetbeans/src/Judge.java


/************************************** Sample Output *************************************/


/****************************** File: Judge.java *****************************/


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Judge {

    public static double getJudgeData() throws IOException {
        double s;
        System.out.println("Enter score between 0 and 10: ");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        s = Double.parseDouble(br.readLine());
        while (s < 0 || s > 10) {
            System.out.println("score must be between 0 and10");
            System.out.println("Enter score between 0 and 10:");
            s = Double.parseDouble(br.readLine());
        }
        return s;
    }

    public static void calcScore(double s[]) {
        double low, high, tot = 0, avg;
        int i;
        low = findLowest(s);
        high = findHighest(s);
        for (i = 0; i < 5; i++) {
            tot += s[i];
        }
        avg = (tot - low - high) / 3.;
        System.out.println("This contestant's talent score is:" + avg);;
    }

    public static double findLowest(double s[]) {
        int i;
        double n;
        n = s[0];
        for (i = 1; i < 5; i++) {
            if (s[i] < n) {
                n = s[i];
            }
        }
        return n;
    }

    public static double findHighest(double s[]) {
        int i;
        double n;
        n = s[0];
        for (i = 1; i < 5; i++) {
            if (s[i] > n) {
                n = s[i];
            }
        }
        return n;
    }

    public static void main(String[] args) throws IOException {
        double[] scores = new double[5];
        int i;
        for (i = 0; i < 5; i++) {
            scores[i] = getJudgeData();
        }
        calcScore(scores);
    }

}




Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote