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

write a java program that will input student name, student #, prelim grade, midt

ID: 3627584 • Letter: W

Question

write a java program that will input student name, student #, prelim grade, midterm grade, pre-finals and final grade, then will compute for the average, AVE = prelim + midterm + pre-finals + final grade / 4,

it will output the student name, student #, prelim, midterm, prefinals and finals grade, average, and the status if failed or not.

"if the average is less than 75 it will display "FAILED" otherwise it will display the ff:
if 97-100 = "1.0"
90- 96 = "1.50"
87- 89 = "1.75"
84- 86 = "2.0"
80- 83 = "2.50"
77- 79 = "2.75"
75- 76 = "3.0"

Explanation / Answer

Third time's the charm hopefully. Sorry, I'm a little rusty on my programming. Minor errors; I fixed them by actually running my program. Here is the result:

import java.io.*;

public class grade

{
public static void main(String[] args) throws Exception
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
String name, num;
double pre, mid, pref, fin;
System.out.println("Student name: ");
name=in.readLine();
System.out.println("Student number: ");
num=in.readLine();
System.out.println("Preliminary grade: ");
pre=Double.parseDouble(in.readLine());
System.out.println("Midterm grade: ");
mid=Double.parseDouble(in.readLine());
System.out.println("Pre-finals grade: ");
pref=Double.parseDouble(in.readLine());
System.out.println("Finals grade: ");
fin=Double.parseDouble(in.readLine());

double avg=(pre+mid+pref+fin)/4;
System.out.println(" Student Information:"+name+" "+num);
System.out.println("Preliminary grade: "+pre);
System.out.println("Midterm grade: "+mid);
System.out.println("Prefinals grade: "+pref);
System.out.println("Finals grade: "+fin);
System.out.println("Average grade: "+avg);
String stg="";

if(avg>=97)
stg="1.0";
else if(avg>=90)
stg="1.50";
else if(avg>=87)
stg="1.75";
else if(avg>=84)
stg="2.0";
else if(avg>=80)
stg="2.50";
else if(avg>=77)
stg="2.75";
else if(avg>=75)
stg="3.0";
else
stg="FAILED";

System.out.println("Status: "+stg);
}

}