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

Basic Problem We are given a collection of scores for a class, and we want to cr

ID: 3640007 • Letter: B

Question

Basic Problem

We are given a collection of scores for a class, and we want to create a histogram of the scores, where we divide the scores into dectiles. So, for example, if the scores for the class were 33, 35, 53, 59, 66, 70, 72, 82, 82, 84, 86, 89, 90, 90, 93, 95, 96, 100, the histogram would look like:

1 - 10:
11 - 20:
21 - 30:
31 - 40:**
41 - 50:
51 - 60:**
61 - 70:**
71 - 80:*
81 - 90:*******
91 -100:****

Furthermore, we will generate the scores for the class by one of two means: (1) ask the user to input the scores and (2) have the computer randomly generate the scores.

So what this program will do is ask the user for the number of students in the class. Then it will ask the user if they want to input the numbers or have the computer generate the scores randomly. Then having the scores, it will output them in a histogram.

Since we want to output the scores via dectiles, we will need an array of size 10. One creates an array of size to via

int [] scores = new int[10];

Each value of scores[i] will record the scores from i*10 to i*10+9.

We will do this by creating a class ClassHistogram, which will have 4 methods: (1) main, (2) generateUser , generateRandom, and outputHistogram.

The abstract data type or ADT of this class can be found here. Its Universal Markup Language or UML version can be found here.

main method

The main method will do the following:

Create the array of scores of size 10.
Ask the user via JOptionPane for the number of students in the class
If the number is positive then
Ask the user if the user or computer is inputing data
Call the appropriate method for input
call the method outputHistogram to show the histogram
If the number is non-positive, tell the via JOptionPane the data must be positive
Ask the user is they want to continue

Explanation / Answer

01 import java.util.Random; 02 03 public class ScoreArray { 04 05 // constructor that receives an array of scores 06 ScoreArray(int[] values) { 07 // ok how many of every thing ranks by 10 08 int[] nbEach = new int[10]; 09 // constructor that receives an array of score 10 for(int i = 0; i
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