Use Jave programming use NetBeans the name of class is asses
Use Jave programming use NetBeans the name of class is assessment_1
Write in Jave a grading program that:
Enter a student name
Generates 5 scores between 50 and 100
Sums the scores
Computes the average of the scores
Converts the scores into a letter grade - A, B, C, D, F where F is below 60%
convert using: if else if else and switch
Print out a name for the student, the average score, and the letter grade
You will be graded on the following program features:
Correct use of indentation.
Correct use of white space
Readability
Verification and validation
Use Jave programming
Solution
/* Java Program Example - Calculate Average and Grade */
import java.util.Scanner;
public class Marks
{
public static void main(String args[])
{
int mark[] = new int[5];
int i;
float sum=0;
float avg;
char grade;
Scanner scan = new Scanner(System.in);
//enter the marks
System.out.print(\"Enter marks Obtained in 5 Subjects : \");
for(i=0; i<5; i++)
{
//calculating sum
mark[i] = scan.nextInt();
sum = sum + mark[i];
}
//calculating average
avg = sum/5;
System.out.print(\"Total Marks = \" +sum);
//calculating grade
System.out.print(\"Grade is : \");
S
if(avg>95)
{
System.out.print(\"A\");
}
else if(avg>90 && avg<=95)
{
System.out.print(\"B\");
}
else if(avg>80 && avg<=85)
{
System.out.print(\"C\");
}
else if(avg>70 && avg<=80)
{
System.out.print(\"D\");
}
else if(avg>60 && avg<=70)
{
System.out.print(\"E\");
}
else
{
System.out.print(\"F\");
}
}
}

