Begin by accessing your Java platform within your virtual lab environment and include the following elements: i am having some issues with a while loop program is not compiling. Create a Java program to accept input for the following two variables: (a) Students and (b) Scores. Create a repetitive loop so the program will ask the user if another entry is desired until the user indicates “No.” Create a variable that will compute the average score for an entire class. Create a variable that will assign a letter grade based on the student’s score using the chart below. Create a variable that will list the number of students who received each of the following grade ranges: A, B, C, D, and F. (Note that “+” and “-” grades fall within the general letter grade range.) Letter Grade Percent A 0.93 A- 0.90 B+ 0.87 B 0.83 B- 0.80 C+ 0.77 C 0.73 C- 0.70 D+ 0.67 D 0.63 D- 0.60
Input:
Output:
import java.util.*;
class Main
{
public static void main (String[] args)
{
Scanner sc = new
Scanner(System.in);
ArrayList<String> students =
new ArrayList<>();
ArrayList<Double> scores =
new ArrayList<>();
ArrayList<String> grades =
new ArrayList<>();
String answer, tmp;
double averageScore = 0.0;
int totalScore = 100; //total score
assumed to be 100
int numberOfStudentsForEachGrade[]
= {0,0,0,0,0}; // 0th index responds to A, similarly
1->B,2->C,3->D,4->F
int studentCount=0;
while(true) {
// This step is required because
after 1 iteration of the loop,
// an empty line is read (scanner
input stream issue)
// and it is taken as the value for
the answer variable
// which results into undesirable
error.
// Therefore, if the empty line is
assigned to a temporary variable,
// there won't be any
problem.
if(studentCount > 0)
tmp = sc.nextLine();
System.out.println("Enter \"No\" to discontinue or else enter
anything");
answer =
sc.nextLine();
if(answer.equalsIgnoreCase("No")) {
break;
}
System.out.println("Enter student name");
String student =
sc.nextLine();
System.out.println("Enter student score");
double score =
sc.nextDouble();
students.add(student);
scores.add(score);
averageScore+=score; // sum of scores till now
// grade
calculation
double percent =
score / totalScore;
if(percent >=
0.93) {
grades.add("A");
numberOfStudentsForEachGrade[0]++;
} else
if(percent >= 0.90) {
grades.add("A-");
numberOfStudentsForEachGrade[0]++;
} else
if(percent >= 0.87) {
grades.add("B+");
numberOfStudentsForEachGrade[1]++;
} else
if(percent >= 0.83) {
grades.add("B");
numberOfStudentsForEachGrade[1]++;
} else
if(percent >= 0.80) {
grades.add("B-");
numberOfStudentsForEachGrade[1]++;
} else
if(percent >= 0.77) {
grades.add("C+");
numberOfStudentsForEachGrade[2]++;
} else
if(percent >= 0.73) {
grades.add("C");
numberOfStudentsForEachGrade[2]++;
} else
if(percent >= 0.70) {
grades.add("C-");
numberOfStudentsForEachGrade[2]++;
} else
if(percent >= 0.67) {
grades.add("D+");
numberOfStudentsForEachGrade[3]++;
} else
if(percent >= 0.63) {
grades.add("D");
numberOfStudentsForEachGrade[3]++;
} else
if(percent >= 0.60) {
grades.add("D-");
numberOfStudentsForEachGrade[3]++;
} else {
grades.add("F");
numberOfStudentsForEachGrade[4]++;
}
//
System.out.println(students.get(studentCount)+"\t"+
//
scores.get(studentCount)+"\t"+grades.get(studentCount));
studentCount++;
}
averageScore =
averageScore/studentCount;
System.out.println("The average
score for an entire class: "+averageScore);
System.out.println("Student\tScore\tGrade");
for(int
i=0;i<students.size();i++) {
System.out.println(students.get(i)+"\t"+scores.get(i)+"\t"+grades.get(i));
}
System.out.println("Number of
students with grade A: "+numberOfStudentsForEachGrade[0]);
System.out.println("Number of
students with grade B: "+numberOfStudentsForEachGrade[1]);
System.out.println("Number of
students with grade C: "+numberOfStudentsForEachGrade[2]);
System.out.println("Number of
students with grade D: "+numberOfStudentsForEachGrade[3]);
System.out.println("Number of
students with grade E: "+numberOfStudentsForEachGrade[4]);
}
}
Begin by accessing your Java platform within your virtual lab environment and include the following elements:...
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...
In Java Main method Your main program will prompt the user for a test name and the number of scores the user will enter. After creating an arraylist to hold the scores, prompt the user for all the scores to hold in the arraylist. After all the scores are entered, then repeat back the score & letter grade. GradeBook Object Create an instance of a GradeBook object and pass the test name and arraylist to set the instance variables. At...
Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...
Create a C++ program to calculate grades as well as descriptive statistics for a set of test scores. The test scores can be entered via a user prompt or through an external file. For each student, you need to provide a student name (string) and a test score (float). The program will do the followings: Assign a grade (A, B, C, D, or F) based on a student’s test score. Display the grade roster as shown below: Name Test Score ...
Java Question Method and 1 dimension arrays (20) YouTube ㄨ Electronics, Cars, Fashion, Co × Upload Assignment: Program xy 9 Program3.pdf eduardo C Secure https://blackboard.kean.edu/bbcswebdav/pid-736390-dt-content-rid-2804166 1/courses/18SP CPS 2231 06/Program3.pdf Concepts: Methods and one dimensional Arrays Point value: 45 points Write a Java Class that reads students grades and assigns grades based on the following grading "curve .Grade is A if the score is greater than or equal to the highest score - 10 .Grade is B if the score is...
Within DrJava, create a class called StudentQuizScores and do the following using a do-while loop. 1. You program will read in a student’s first name. The same will be done for the student’s last name. Your program will use respective methods (described below) to accomplish this. 2. Your program will then read in three quiz scores, respectively. This should be done by using the same method three times. This method is described below. 3. Your program will then calculate the...
Using Java, write a program that teachers can use to enter and calculate grades of individual students by utilizing an array, Scanner object, casting, and the print method. First, let the user choose the size for the integer array by using a Scanner object. The integer array will hold individual assignment grades of a fictional student. Next, use a loop to populate the integer array with individual grades. Make sure each individual grade entered by the user fills just one...
Declare and initialize 4 Constants for the course category weights: The weight of Homework will be 15% The weight of Tests will be 35% The weight of the Mid term will be 20% The weight of the Fin al will be 30% Remember to name your Constants according to Java standards. Declare a variable to store the input for the number of homework scores and use a Scanner method to read the value from the Console. Declare two variables: one...
Input hello, I need help completing my assignment for java,Use the following test data for input and fill in missing code, and please screenshot output. 1, John Adam, 3, 93, 91, 100, Letter 2, Raymond Woo, 3, 65, 68, 63, Letter 3, Rick Smith, 3, 50, 58, 53, Letter 4, Ray Bartlett, 3, 62, 64, 69, Letter 5, Mary Russell, 3, 93, 90, 98, Letter 6, Andy Wong, 3, 89,88,84, Letter 7, Jay Russell, 3, 71,73,78, Letter 8, Jimmie Wong,...
( Object array + input) Write a Java program to meet the following requirements: 1. Define a class called Student which contains: 1.1 data fields: a. An integer data field contains student id b. Two String data fields named firstname and lastname c. A String data field contains student’s email address 1.2 methods: a. A no-arg constructor that will create a default student object. b. A constructor that creates a student with the specified student id, firstname, lastname and email_address...