Rewrite Listing 8.2, GradeExam.java, to display the students in increasing order of the number of correct answers.
Question:
Rewrite Listing 8.2, GradeExam.java, to display the students in increasing order of the number of correct answers.
Listing
Transcribed Image Text:
1 public class GradeExam { 2 /** Main method */ public static void main(String[] args) { // Students' answers to the questions char[][] answers = {'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'}}; 3 5 10 11 12 13 14 15 16 17 18 19 20 // Key to the questions char[] keys = {'D', 'B', 'D', 'C', 'C', 'D', 'A', 'E', 'A', 'D'}; // Grade all answers for (int i = 0; i < answers.length; i++) { // Grade one student int correctCount = 0; for (int j = 0; j < answers[i].length; j++) { if (answers [i][j] == keys [j]) correctCount++; 21 22 23 24 25 26 27 System.out.println("Student" +i+ "'s correct count is correctCount); 28 29 30 31 } Student 0's correct count is 7 Student 1's correct count is 6 Student 2's correct count is 5 Student 3's correct count is 4 Student 4's correct count is 8 Student 5's correct count is 7 Student 6's correct count is 7 Student 7's correct count is 7
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 93% (16 reviews)
Header section import class declartion class Begin ...View the full answer
Answered By
Nazrin Ziad
I am a post graduate in Zoology with specialization in Entomology.I also have a Bachelor degree in Education.I posess more than 10 years of teaching as well as tutoring experience.I have done a project on histopathological analysis on alcohol treated liver of Albino Mice.
I can deal with every field under Biology from basic to advanced level.I can also guide you for your project works related to biological subjects other than tutoring.You can also seek my help for cracking competitive exams with biology as one of the subjects.
3.30+
2+ Reviews
10+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Rewrite Listing 18.7, DirectorySize.java, without using recursion. Listing 1 import java.io.File; 2 import java.util.Scanner; 3 4 public class DirectorySize { public static void main(String[] args) {...
-
Rewrite Listing 12.18, WebCrawler.java, to improve the performance by using appropriate new data structures for listOfPendingURLs and listofTraversedURLs. Suppose you have Java source files under the...
-
Rewrite Listing 21.9 to read the text from a text file. The text file is passed as a command-line argument. Words are delimited by whitespace characters, punctuation marks (,;.:?), quotation marks...
-
The $1.6 Billion Mega-millions winning lottery ticket is based upon the total amount of cash received if the annuity option is taken. The cash prize is $913,700,000 which you get immediately. The...
-
Without calculation, find one eigenvalue and two linearly independent eigenvectors of Justify your answer 22 21 A=1222 2
-
Recognize that there are many leadership models and many different dimensions as a foundation for them; accept their lessons while seeking ways to integrate them. lop5
-
Cameron Bly is a sales manager for an automobile dealership. He earns a bonus each year based ETHICS on revenue from the number of autos sold in the year less related warranty expenses. Actual...
-
Over the past few years the percentage of students who leave Lakeland College at the end of the first year has increased. Last year Lakeland started a voluntary one-week orientation program to help...
-
Sheffield Laboratories holds a valuable patent (No. 758-6002-1A) on a precipitator that prevents certain types of air pollution. Sheffield does not manufacture or sell the products and processes it...
-
Please solve this problem using C language Hacker Industries has a number of employees. The company assigns each employee a numeric evaluation score and stores these scores in a list. A manager is...
-
a. Given the following, journalize the adjusting entry. By December 31, 2020, $210 worth of the unearned dog-walking fees were earned. b. What is the account category of unearned dog-walking fees?...
-
Suppose the weekly hours for all employees are stored in a two-dimensional array. Each row records an employee?s seven-day work hours with seven columns. For example, the following array stores the...
-
A four input summing amplifier has R1 = R2 = R3 = R4 12k(. What value of feedback resistor is needed to make it an averaging amplifier?
-
Write a function report card where the user can enter each of his grades, after which the program prints out a report card with GPA. Remember to ask the user how many classes he took (think - why...
-
VA= 18/ A c = ? 1. For the arrangement of cable and pulleys in the figure, the velocities and accelerations of two of the bodies involved are indicated. Determine the velocity and acceleration of the...
-
Suppose there are two electric charges in 2D planeR2; one is on y-axis and the other is on x-axis: 45km 0 p1:=0,p2:=30km.(1) Thechargesareq1=4.5Catp1andq2=3.0Catp2. (a) Determine the electric field...
-
6.10 Long Div. and Comp Square Calculus - No Calculator Find the indefinite integral. 1. S 4x-34x+56x-21 4x-2 dx Mastery Check #2 1 dx 2. Sx-4x+5x x-4x+5 S S Name: Sienna Nono Date: 3-1-24 Period:...
-
How well are oncology firms leveraging digital technology to gain and sustain competitive advantage?
-
Which of the following should a program use to store the name of any city in a string variable named cityName? a. cin >> cityName; b. cin(cityName); c. getline(cityName, cin); d. getline(cin,...
-
Refer to the data for problem 13-36 regarding Long Beach Pharmaceutical Company. Required: Compute each division's residual income for the year under each of the following assumptions about the...
-
If a superclass constructor requires arguments, any constructor of its subclasses must call the superclass constructor ____________. a. As the first statement b. As the last statement c. At some time...
-
A child class Motorcycle extends a parent class Vehicle. Each class constructor requires one String argument. The Motorcycle class constructor can call the Vehicle class constructor with the...
-
In Java, the concept of keeping data private is known as ____________. a. Polymorphism b. Concealing fields c. Data deception d. Information hiding
-
i just need anssers for G,h1,h2,h3 120 a. If the opportunity cost of capital is 11%, which of these two projects would you accept (A, B, or both)? b. Suppose that you can choose only one of these two...
-
In using Verizon Communications Inc as a case analysis, what is their product portfolio, competitors and competitive Environment?/
-
Tony and Suzie graduate from college in May 2021 and begin developing their new business. They begin by offering clinics for basic outdoor activities such as mountain biking or kayaking. Upon...
Study smarter with the SolutionInn App