Students in this course take four exams and earn a letter grade (A+, A, A-, B+, B, B-, C+, C, C-, D+, D, D-, or F) for e

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Students in this course take four exams and earn a letter grade (A+, A, A-, B+, B, B-, C+, C, C-, D+, D, D-, or F) for e

Post by answerhappygod »

Students In This Course Take Four Exams And Earn A Letter Grade A A A B B B C C C D D D Or F For E 1
Students In This Course Take Four Exams And Earn A Letter Grade A A A B B B C C C D D D Or F For E 1 (33.16 KiB) Viewed 48 times
Students In This Course Take Four Exams And Earn A Letter Grade A A A B B B C C C D D D Or F For E 2
Students In This Course Take Four Exams And Earn A Letter Grade A A A B B B C C C D D D Or F For E 2 (23.72 KiB) Viewed 48 times
Students In This Course Take Four Exams And Earn A Letter Grade A A A B B B C C C D D D Or F For E 3
Students In This Course Take Four Exams And Earn A Letter Grade A A A B B B C C C D D D Or F For E 3 (25.7 KiB) Viewed 48 times
Students In This Course Take Four Exams And Earn A Letter Grade A A A B B B C C C D D D Or F For E 4
Students In This Course Take Four Exams And Earn A Letter Grade A A A B B B C C C D D D Or F For E 4 (28.44 KiB) Viewed 48 times
Students in this course take four exams and earn a letter grade (A+, A, A-, B+, B, B-, C+, C, C-, D+, D, D-, or F) for each of them. The course grade is determined by dropping the lowest grade and averaging the three remaining grades. To average grades, first convert them to number grades, using the usual scheme A+ = 4.3, A=4.0, A- = 3.7, B+= 3.3, D-=0.7, F = 0. Then compute their average and convert it back to the closest letter grade. For example, an average of 3.51 would be an A-. Your task is to read inputs of the form: letterGradel letterGrade2 letterGrade3 letterGrade4 For example, A- B+ CA For each input line, your output should be letterGrade where the letter grade is the grade earned in the course, as just described. For example, A- The end of inputs will be indicated by aletterGrade1 input of Q.
1 import java.util.Scanner; 2 3 /** 4 5 6 */ 7 public class Grades 8 { 9 10 11 12 13 14 15 1.C This program reads inputs that contain four grades per line and displays the average grade for each input line. Run public static void main(String[] args) { } A-B+CA ABBA CC-D+ C Scanner in new Scanner(System.in); while (processLine(in)) Grades.java { } Load default
232 24 25 26 27 28 29 30 31 32 33 34 35 36 37 public static boolean processLine (Scanner in) System.out.print("Enter four grades or Q to quit: "); // Read four grades String g1 in.next(); if (g1.equals("Q")) { return false; } String g2= in.next(); String g3 in.next(); String g4 in.next(); E // Compute and print their average A-B+ CA ABBA CC-D+ C Run double x1 = gradeToNumber(g1); double x2 aradeToNumber(a2): B
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 Converts a letter grade to a number. @param grade a letter grade (A+, A, A-, ..., D-, F) @return the equivalent number grade public static double gradeToNumber (String grade) { A- B+ CA ABBA CC-D+ C double result = 0; = String first grade.substring(0, 1); if (first.equals("A")) { result = 4; } else if (first.equals("B")) { result = 3; } else if (first.equals("C")) { result = 2; } else if (first.equals("D")) { result = 1; } if (grade.length() > 1) { String second grade.substring(1, 2); if (second.equals("+")) I
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply