Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The program reads a text file with student records (first name, last name and gr

ID: 3659417 • Letter: T

Question

The program reads a text file with student records (first name, last name and grade) and prints them in the terminal window. After the name and grade it also prints the type of the grade: excellent (> 89), ok [60,89], and failure (< 60). Then the program prints the number of students, and their average grade and also the number of students and their average in each grade category (excellent, ok, and failure). please please please help public class Student { String fname, lname; int grade; public Student(String fname, String lname, int grade) { this.fname = fname; this.lname = lname; this.grade = grade; } public String toString() { return fname + " " + lname + " " + grade; } } n

Explanation / Answer

class AddRationals { public static void main (String[] args) { String div; int a, b, c, d, e, f; //declairs the integers Scanner scan = new Scanner(System.in); System.out.print("Type a rational number (a / b): "); //tells user to type in a rational number a = scan.nextInt(); div = scan.next("/"); b = scan.nextInt(); System.out.print("Type another rational number (c / d): "); //tells user to type in another rational number c = scan.nextInt(); div = scan.next("/"); d = scan.nextInt(); System.out.print("Type another rational number (e / f): "); //tells user to type in another rational number e = scan.nextInt(); div = scan.next("/"); f = scan.nextInt(); Rational p = new Rational(a,b); // p points to a new instance of Rational Rational q = new Rational(c,d); // q points to a new instance of Rational Rational t = new Rational(e,f); Rational r = p.sum(q); // no need of new here, sum returns a new Ratonal object Rational s = r.sum(t); System.out.println(p + " + " + q + " + " + t + " = " + s); //Adds P + Q + T and finds S s.reduce(); System.out.println("Reduced sum is: " + s); // Prints the sum if (p.lessThan(q) && p.lessThan(t)) System.out.println("Minimum is " + p); //Prints the Minimum else System.out.println("Minimum is " + q); } }