Question
I keep on getting errors in my program. I don't know what I am doing wrong. Task #1 Average Class Create a class called Average
I keep on getting errors in my program. I don't know what I am doing wrong.
Task #1 Average Class
Create a class called Average according to the UML diagram.
Average
-data [ ] :int
-mean: double
+Average( ):
+calculateMean( ): void
+toString( ): String
+selectionSort( ): void
This class will allow a user to enter 5 scores into an array. It will then rearrange the data in descending order and calculate the mean for the data set.
Attributes: data[] the array which will contain the scores mean the arithmetic average of the scores Methods: Average The constructor.The constructor will then call the selectionSort and the calculateMean methods. calculateMean this is a method that uses a for loop to access each score in the array and add it to a running total. The total divided by the number of scores (use the length of the array), and the result is stored into the mean. toString returns a String containing data in descending order and the mean. selectionSort this method uses the selection sort algorithm to rearrange the data set from highest to lowest.
class average { private int[] data; private double mean; average () { this.data= new int[5]; this.mean=0; Scanner keyboard = new Scanner(System.in); for(int i=0; i
Step 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