Computer Science, asked by komal2867, 9 days ago

Write a program to accept student’s name, class and division, roll no, total marks out of 1000. Calculate percentage. Assign grade and give remark accordingly. (Percentage between 100 and 80, grade A remarkExcellent, between 80 and 60 grade B remark- Good, between 60 and 40 grade C remark- Satisfactory, less than 40 grade D remark- Must work hard)

Answers

Answered by ItzMeSam35
2

import java.util.Scanner.*;

public class Grades

{

public static void main(String args [])

{

String studentName, studentClass, classDivision Remarks;

char studentGrade;

int rollNumber, sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8, sub9, sub10;

double totalMarks, percentageMarks;

Scanner input = new Scanner(System.in);

System.out.print("Enter Student's Name : ");

studentName = input.nextLine();

System.out.print("Enter Class : ");

studentClass = input.nextLine();

System.out.print("Enter Class Division : ");

classDivision = input.nextLine();

System.out.print("Enter Roll Number : ");

rollNumber = input.nextInt();

System.out.print("Enter Marks In 10 Subjects :);

sub1 = input.nextInt();

sub2 = input.nextInt();

sub3 = input.nextInt();

sub4 = input.nextInt();

sub5 = input.nextInt();

sub6 = input.nextInt();

sub7 = input.nextInt();

sub8 = input.nextInt();

sub9 = input.nextInt();

sub10 = input.nextInt();

totalMarks = sub1+sub2+sub3+sub4+sub5+sub6+sub7+sub8+sub9+sub10;

percentageMarks = (totalMarks/1000.0) * 100;

if ((percentageMarks >=80)&&(percentageMarks <= 100))

{

studentGrade = 'A';

Remarks = "Excellent";

System.out.println("Student's Name : "+studentName);

System.out.println("Class : "+studentClass);

System.out.println("Division : "+classDivision);

System.out.println("Roll Number : "+rollNumber);

System.out.println("Marks : "+sub1+" , "+sub2+" , "+sub3+" , "+sub4+" , "+sub5+" , "+sub6+" , "+sub7+" , "+sub8+" , "+sub9+" , "+sub10);

System.out.println("Total Marks : "+totalMarks);

System.out.println("Percentage Marks : "+percentageMarks);

System.out.println("Grade : "+studentGrade);

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

}

else if ((percentageMarks >=60)&&(percentageMarks <= 80))

{

studentGrade = 'B';

Remarks = "Good";

System.out.println("Student's Name : "+studentName);

System.out.println("Class : "+studentClass);

System.out.println("Division : "+classDivision);

System.out.println("Roll Number : "+rollNumber);

System.out.println("Marks : "+sub1+" , "+sub2+" , "+sub3+" , "+sub4+" , "+sub5+" , "+sub6+" , "+sub7+" , "+sub8+" , "+sub9+" , "+sub10);

System.out.println("Total Marks : "+totalMarks);

System.out.println("Percentage Marks : "+percentageMarks);

System.out.println("Grade : "+studentGrade);

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

}

else if ((percentageMarks >=40)&&(percentageMarks <= 60))

{

studentGrade = 'C';

Remarks = "Satisfactory";

System.out.println("Student's Name : "+studentName);

System.out.println("Class : "+studentClass);

System.out.println("Division : "+classDivision);

System.out.println("Roll Number : "+rollNumber);

System.out.println("Marks : "+sub1+" , "+sub2+" , "+sub3+" , "+sub4+" , "+sub5+" , "+sub6+" , "+sub7+" , "+sub8+" , "+sub9+" , "+sub10);

System.out.println("Total Marks : "+totalMarks);

System.out.println("Percentage Marks : "+percentageMarks);

System.out.println("Grade : "+studentGrade);

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

}

else if (percentageMarks < 40)

{

studentGrade = 'D';

Remarks = "Must Work Hard";

System.out.println("Student's Name : "+studentName);

System.out.println("Class : "+studentClass);

System.out.println("Division : "+classDivision);

System.out.println("Roll Number : "+rollNumber);

System.out.println("Marks : "+sub1+" , "+sub2+" , "+sub3+" , "+sub4+" , "+sub5+" , "+sub6+" , "+sub7+" , "+sub8+" , "+sub9+" , "+sub10);

System.out.println("Total Marks : "+totalMarks);

System.out.println("Percentage Marks : "+percentageMarks);

System.out.println("Grade : "+studentGrade);

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

}

input.close();

}

}

Similar questions