Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description: n this activity, you will create a class called Scores that will hold an array of numerical values and provide methods that allow users
Description: n this activity, you will create a class called Scores that will hold an array of numerical values and provide methods that allow users to interact with the Scores class. Directions: Don 't forget to add your Javadoc comments for your classes, constructor,and methods in this activity. Part 1: Scores - instance variable, constructor and method stubs Create a class called Scores. Add an instance variable with the name numbers to your class that is an array of int values: o private intl] numbers; Add a constructor that has a parameter declared as an array of int values. o public Scores (int[l numbersIn) t * Add method stubs for the following methods. The first one is given; do the rest on your own o findEvens: no parameter, returns an array of int (all of the even-valued scores) public int[] findEvens() { return nu1 ndeAn aray is an objeet so mull An array is an object, so null is a placeholder return. o findodds: no parameter, returns an array of ints (all of the odd-valued scores) o calculateAverage: no parameters; returns a double (the average of all scores) o tostring: no parameters; returns a String containing all scores o tostringInReverse: no parameters; returns a String containing all scores in reverse order Compile Scores and run the following in interactions. Do not continue until your program compiles and the following code runs without error in interactions. Scores s new Scores (null); intI] evenss.findEvens (; intl] odds s.findodds) h double avg s.calculateAverage()
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