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: 91% (12 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
-
At the end of Part 3 of the text, on Social Behaviour and Organizational Processes, you answered a number of questions about the Ken Private Limited: Digitization Project Integrative Case that dealt...
-
Can you present a graphic that presents the payroll disbursement amounts by date for the contact employee who has been terminated but has been paid after termination (i.e., ghost employees)?
-
Lima Company manufactured 30,000 units of product last month and identified the following costs associated with the manufacturing activity: Variable costs: Direct materials used. . . . . . . . . . ....
-
The adjusted trial balance for Chiara Company as of December 31 follows. Cash Accounts receivable Interest receivable Debit $ 30,000 Credit 52,000 18,000 nt ok Notes receivable (due in 90 days)...
-
A 5500-kg cart carrying a vertical rocket launcher moves to the right at a constant speed of 30.0 m/s along a horizontal track. It launches a 45.O-kg rocket vertically upward with an initial speed of...
-
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...
-
One of Roxanne Quimbys motivations in starting businesses included helping employ people in her community. How does or doesnt this motivation fit in the definition of an entrepreneur as someone who...
-
Discuss Contract Law, Tort law, and the elements of a contract. Comment as to whether you had any previous knowledge or whether the classes added to your existing knowledge. How do you anticipate the...
-
In The Accounting Review article "The effect of antitrust investigation on discretionary accruals: A refined test of the political-cost hypothesis", Cahan (1992) found that U.S. managers adjusted...
-
Calculating Returns and Variability (LOI) You've observed the following returns on Regina Computer's stock over the past five years: 7%, -12%, 11%, 38%, and 14%. a. What was the arithmetic average...
-
Claire passed away during 2020. At the time she passed away, she owned her home which had a cost of $100,000 and a fair market value of $160,000, and an RRSP account with a cost of $30,000 and a fair...
-
Raymond, Inc. distributes and markets athletic apparel from its corporate headquarters in Fond Du Lac, Wisconsin and it sells them to the Sound Tigers Management of Bridgeport, Connecticut. Raymond...
-
Refer to the data in QS 16-11. 1. Assume that all common stock is issued for cash. What amount of cash dividends is paid during 2017? 2. Assume that no additional notes payable are issued in 2017....
-
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
-
list 3 concepts in any subject area (ELA, Math, Science, Social Studies, etc.) that can be illustrated into a simple cartoon for students to explore, expand, or solve. Describe how the cartoon would...
-
Post should be at least 300350 words in length and should extend the discussion of the group supported by your course materials and/or other appropriate resource The goal of classroom behavior...
-
How do customer perceptions of equitys brand values compare to its competitors?
Study smarter with the SolutionInn App