In this question, we will simulate the Winter-Olympic judges' score by randomly generating five (5) scores between 7 and

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

In this question, we will simulate the Winter-Olympic judges' score by randomly generating five (5) scores between 7 and

Post by answerhappygod »

In This Question We Will Simulate The Winter Olympic Judges Score By Randomly Generating Five 5 Scores Between 7 And 1
In This Question We Will Simulate The Winter Olympic Judges Score By Randomly Generating Five 5 Scores Between 7 And 1 (147.03 KiB) Viewed 57 times
how I going to do to make sure my output similar like sample
output, I already finish some part except the part after the array
print discarding highest and lowest scores and final score for the
last one array.
In this question, we will simulate the Winter-Olympic judges' score by randomly generating five (5) scores between 7 and 10 (<7=score<10), and then get the final score by discarding the maximum and the minimum scores out of the five. This lab will give you a good practice in writing public static methods using arrays. 1. Create a package named Qi. 1 3. Create a public class called SimulateJudgesScore. 4. Define a public static method with the header: public static void populateArray (double[] anyName) This method will populate the array referenced by the array-reference variable anyName. The values will be generated by the Math.random() method with the range: 7<=number<10 (see Unit 2.5, slide 36); we discussed the random number generation idea in the class on the 9th of March. 5. Define a public static method display Array() with the header: public static void displayArray ( double[] anyName) This method will display the array-content using the format shown in the sample output. Take a second look at the displayed arrays - the last ", " is not there. You can implement it in many ways. One way to accomplish this is to use the backspace escape character (lb) discussed in Unit 2. For example, System.out.println("Hi there!23\h\b"); will remove 3 and 2 with the help of two lb characters while printing "Hi there!". 6. Define a public static method called finalScore() with the following header: public static double finalscore( double[] anyName) This method will have the following specifications: a. Declare an array reference variable to refer to a double-type array with the same size of the array referred to by anyName. b. Copy the content of anyName to this new array using System.arraycopy0 method (see Unit 6 [Brief Version] slide 25-26) c. Find the maximum and minimum values from the anyName array. Once found, overwrite the maximum and minimum values in the other array you created with zero values. Hint: you can use the index values of the maximum and minimum numbers and then assign zero to the corresponding indexed elements in the new array. See your instructor for ideas about it. d. Print these maximum and minimum values on the screen (see the sample output) e. Print the content of the new array that has zeros in place of maximum and minimum values (see the sample output) f. Now find the average of all the scores from the new array and return it.

7. Define a driver method using the specifications below: a. Call your myHeader() method you created in MyMethod class. The call will be MyMethod.myHeader(arguments). b. Declare an array reference variable to refer to five (5) double type variables to store the scores from five (5) judges. c. Populate the array my calling he populateArray() method. d. Display the array content with by calling the displayArray() method (see the sample output) e. Display the final score of the athlete by calling the finalScore() method f. Call your myFooter() method from your MyMethod class. The call will be MyMethod.myFooter(). Sample Output Note: Every run will result in different output. Here is the sample output of a run: ******* *** *金合金 ***** Lab 7, Question 1 ************************* Here are the scores from 5 Judges: [8.67, 7.44, 9.88, 7.90, 8.45] Highest Score: 9.88 Lowest Score: 7.44 Here are the scores after discarding the highest and the lowest scores: [8.67, 0.00, 0.00, 7.90, 8.45] The final score is: 8.34 *** Goodbye from
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply