Wednesday, February 9, 2022

Computation of Grades in Java

 A program that will compute the grades of the student and then it will display the letter grade of the student using Java programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.






Program Listing



/* grades.java
*
* Author : Jake Rodriguez Pomperada, MAED-IT, MIT
* www.jakerpomperada.com and www.jakerpomperada.blogspot.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philipipines
*/ import java.util.Scanner; public class grades {
/** Main method */
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);

int[] scores = new int[100];
int average=0; int total_sum=0, numberOfGrades;
char grade = 0;
int grades=0;
int i=0;

System.out.println();
System.out.println("\tComputation of Grades in Java");
System.out.println();
System.out.print("# of grades: ");
numberOfGrades = input.nextInt(); for (i = 1; i <= numberOfGrades; i++) {
System.out.print("("+i+"): ");
scores[i] = input.nextInt();

} System.out.println();

for ( i = 1; i <= numberOfGrades; i++) {

total_sum+=scores[i];
average = (total_sum/numberOfGrades)* 10;
grades = (average);
}
System.out.print(grades);


System.out.println();


String output = "";
if (grades >= 91 && grades <= 100)
grade = 'A';
else if (grades >= 81 && grades <= 90)
grade = 'B';
else if (grades >= 71 && grades <= 80)
grade = 'C';
else if (grades >= 61 && grades <= 70)
grade = 'D';
else if (grades <= 60)
grade = 'E'; output += "Your Grade is " + grades + ": Descriptive Rating: "
+ grade;

System.out.println();
System.out.println(output);
input.close();
}
}


No comments:

Post a Comment