Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IT HAS TO WORK ON NETBEANS! THANK YOU. This program is based on Listing 8.2 on page 295 of your textbook. Use it as a

IT HAS TO WORK ON NETBEANS! THANK YOU.

This program is based on Listing 8.2 on page 295 of your textbook. Use it as a guide.

Create a new project called GradingProj, with a main class as shown below. Some of the final code is already provided for you to save you typing and point the way.

Create a method called getGrade() that takes three inputs: the student answers array, the answer key array, and the index of each student (row) in the student answers array (where the first row is Student 0 and the last row is Student 7). The output of the method should be the number of correct answers.

Unlike the program on page 295, I want you to call into the getGrade() method and do the "inner loop" in the method (which is the actual calculating of how many answer are correct for the student). And then return the number of correct answers.

Back in the main(), within the "outer loop", you should do 2 rows of output for each student. The output should be this:

Student Barnes achieved 7 correct answers.

Student Barnes earned a C.

Student Smith achieved 6 correct answers.

Student Smith earned a D.

Student Jones achieved 5 correct answers.

Student Jones earned an F.

Student Garcia achieved 4 correct answers.

Student Garcia earned an F.

Student Wills achieved 8 correct answers.

Student Wills earned a B.

Student Milford achieved 7 correct answers.

Student Milford earned a C.

Student Anitan achieved 7 correct answers.

Student Anitan earned a C.

Student Dibrois achieved 7 correct answers.

Student Dibrois earned a C.

//-----------------------------------CODE-----------------------------------------------------

public class GradingProj_MainClass {

private final static int NUM_STUDENTS = 8; //rows

private final static int NUM_GRADES = 10; //columns

private static int correctCount;

public static void main(String[] args) {

char [][] stdAnsArr = {

{'A', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},

{'D', 'B', 'A', 'B', 'C', 'A', 'E', 'E', 'A', 'D'},

{'E', 'D', 'D', 'A', 'C', 'B', 'E', 'E', 'A', 'D'},

{'C', 'B', 'A', 'E', 'D', 'C', 'E', 'E', 'A', 'D'},

{'A', 'B', 'D', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},

{'B', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},

{'B', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},

{'E', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}};

char [] keysArr = {'D', 'B', 'D', 'C', 'C', 'D', 'A', 'E', 'A', 'D'};

String [] studentsArr = {"Barnes", "Smith", "Jones", "Garcia", "Wills", "Milford", "Anitan", "Dibrois", "Seawald", "Chance"};

for (int i = 0; i < NUM_STUDENTS; i++)

{

//call into getGrades()

//do logic for your output, correlating the index of the Students between the stdAnsArr and the studentsArr for the "lookup" and nice output

}

} //end main()

//getGrades() goes here

} //end Mainlass

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions