Question

Make a Gradebook. It needs to have student numbers(random(index)) and random generated scores (also A->F). They need to be sorted and sum up at the bottom. How many got A, how many got B and so on. The class average also needs to be printed. The number of students is 20 and the scores are 0-200.
It has to print out so that every time
A. 10%
B. 25%
C. 30%
D. 25%
E. 10%
and of course every student that gets 30 points or less gets an F.

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class Gradebook {

public static void main(String[] args)
{
int[] stuNums = new int[20];
int[] scores = new int[20];
int[] gradeCount = new int[6];
int total = 0;
double average;
boolean swapped;
for(int i = 0; i < 20; i++)
{
stuNums[i] = (int)(Math.random()*Integer.MAX_VALUE);
double val = Math.random();
if(i < 2)
scores[i] = (int)(Math.random() * 20) + 180;
else if(i < 7)
scores[i] = (int)(Math.random() * 38) + 141;
else if(i < 12)
scores[i] = (int)(Math.random() * 50) + 90;
else if(i < 17)
scores[i] = (int)(Math.random() * 41) + 48;
else if(i < 19)
scores[i] = (int)(Math.random() * 17) + 30;
else
scores[i] = (int)(Math.random() * 30);
total += scores[i];
}
average = total/20.0;
for(int i = 0; i < 6; i++)
gradeCount[i] = 0;
do
{...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Directed Graph in Java
Homework Solution
$40.00
Java
Programming
Codes
Algorithms
Graphs
Nodes
Edges
Dept-First-Search
Statements
Variables
Loops
Variables
Input
Output
From BS Tree to AVL Tree in Java
Homework Solution
$20.00
Java
Programming
Codes
Algorithms
Binary Search Tree
AVL Tree
Search Operation
Logarithmic Time
Rebalancing
Loops
Statements
Variables
Successors
Ancestors
Parents
Nodes
Edges
Boolean Values
Data Structures
LinkedList in Java
Homework Solution
$30.00
Java
Programming
Computer Science
LinkedList
Methods
Variables
Statements
Players
Game Results
Client Code
List Head
Positions
Nodes
Get help from a qualified tutor
Live Chats