At the olympic games many of the events are judged in the fo

At the olympic games many of the events are judged in the following manner. An individual athletes performance is judged by a variabe nus smber of judges (up to 10.) Each of the athletes recieve a grade from 0.00 to 10.0 from each of the judges. The performance score of the athletes is obtained by rejecting both the lowest and the highest score and taking the average of the remaining scores.

Your program is to compute the average score for each athlete. it should print out the athlete ID followed by the average score for that athlete.

Data to be used:

ID     judge    score

2365   7      8.8 7.4 6.3 7.1 5.6 7.3 6.4

2345   6      8.9 8.9 4.5 4.5 6.7 9.2

4356   8      8.8 8.8 5.7 8.9 9.4 2.3 6.7 5.9

7865   5      7.8 5.3 2.3 6.9 9.9

2319   6      8.8 8.8 8.8 8.8 8.8 8.8

4508   7      8.9 9.4 2.3 5.6 3.4 9.9 9.9

I am supposed to do this WITHOUT using an array. I believe that these are too many variables to use with a function aswell. Im not sure how to get the various score inputs. TIA

Solution

#include #include public class Scores { public static void main(String[] args) { System.out.println(\"Enter number of judges.\"); int j = IO.readInt(); while (j < 3) { IO.reportBadInput(); System.out.println(\"Enter number of judges.\"); j = IO.readInt(); } int count = 0; double sum = 0; double highest = 0.0; double lowest = 10.0; double score; double average; for (count = 0; count < j; count = count + 1) { System.out.println(\"Enter score of judge.\"); score = IO.readDouble(); while (score > 10.0 || score < 0.0) { IO.reportBadInput(); System.out.println(\"Enter score of judge.\"); score = IO.readDouble(); } if (score > highest) { score = highest; } else if (score < lowest); { score = lowest; sum = sum + score - highest - lowest; average = sum / (j - 2); System.out.println(lowest); } } } }
At the olympic games many of the events are judged in the following manner. An individual athletes performance is judged by a variabe nus smber of judges (up to

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site