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

I don\'t need the whole thing done, but I don\'t even know where to start. I don

ID: 3784277 • Letter: I

Question

I don't need the whole thing done, but I don't even know where to start. I don't want anything too complicated or too advanced since we haven't gone over a whole lot in the class. My teacher doesn't explain things well and I learn better by seeing something done and then going back and seeing why it was done that way. The names of students and the exam scores will be pulled from a .dat file. This is for JAVA.

Program 2: Grading System Description Write a program that calculates a student's exam average and course grade. Input will be read from a single file that contains a student's name (single string with no whitespace) and 3 separate exam scores. Your program should print the student's name, each exam score, the average score, and a letter grade based on the following scale: A: 90% or higher B: 80% or higher C: 70% or higher D: 60% or higher F: below 60 If at least one exam was failed (below 60%) and the student has a passing grade (D or higher), print the following message: least one exam was failed. Make-up work may be required to pass "At the class. Sample Input/Output Sample input 1 Mars, Bruno 70 81 92 Execution Mars, Bruno Exam 1 70.0 Exam 2 81.0 Show all

Explanation / Answer

Hi Please find my implementation.

Please let me know in case of any issue.

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

public class Grade {

  

   public static void main(String[] args) throws FileNotFoundException {

      

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter input file name: ");

       String fileName = sc.next();

      

       //opening file

       Scanner input = new Scanner(new File(fileName));

      

       // reading name

       String name = input.next();

      

       // reading three scores

       int first = input.nextInt();

       int second = input.nextInt();

       int third = input.nextInt();

      

       // calculating average

       double average = (first+second+third)/3.0;

       char grade = 'A';

       if(average >= 90)

           grade = 'A';

       else if(average >= 80)

           grade = 'B';

       else if(average >= 70)

           grade = 'C';

       else if(average >= 60)

           grade = 'D';

       else

           grade = 'F';

      

       System.out.println("Name: "+name);

       System.out.println("Exam 1: "+first+", Exam 2: "+second+", and Exam 3: "+third);

       System.out.println("Average Score: "+average);

       System.out.println("grade: "+grade);

      

       if((first < 60 || second < 60 || third < 60) && grade <= 'D')

           System.out.println("At least one exam was failed. Make-up work ay be required to pass the class.");

   }

}

/*

Sample run:

Enter input file name: input.txt

Name: Pravesh,Kumar

Exam 1: 70, Exam 2: 81, and Exam 3: 92

Average Score: 81.0

grade: B

*/

########## input.txt #######
Pravesh,Kumar 70 81 92

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote