You are on page 1of 8

PROGRAM:

import java.util.*;

class Student

int Reg_no;

String name;

int marks1;

int marks2;

int marks3;

int marks4;

int marks5;

int marks6;

int total;

int avg;

int percent;

Scanner sc = new Scanner(System.in);

void Getdetails()
{

System.out.println("Enter your Roll_No: ");

Reg_no=sc.nextInt();

System.out.println("Enter your Name: ");

name=sc.next();

System.out.println("Enter marks of 1st subject: ");

marks1=sc.nextInt();

System.out.println("Enter marks of 2nd subject: ");

marks2=sc.nextInt();

System.out.println("Enter marks of 3rd subject: ");

marks3=sc.nextInt();

System.out.println("Enter marks of 4th subject: ");

marks4=sc.nextInt();

System.out.println("Enter marks of 5th subject: ");

marks5=sc.nextInt();

System.out.println("Enter marks of 6th subject: ");

marks6=sc.nextInt();
}

void Display()

System.out.println("\n\n");

System.out.println("***FINAL RESULT***");

System.out.println("Roll No::"+Reg_no);

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

System.out.println("Marks of 1st subject::"+marks1+"/100");

System.out.println("Marks of 2nd subject::"+marks2+"/100");

System.out.println("Marks of 3rd subject::"+marks3+"/100");

System.out.println("Marks of 4th subject::"+marks4+"/100");

System.out.println("Marks of 5th subject::"+marks5+"/100");

System.out.println("Marks of 6th subject::"+marks6+"/100");

void Total()

total=(marks1+marks2+marks3+marks4+marks5+marks6);
System.out.println("Total marks is:"+total);

void Average()

avg=(marks1+marks2+marks3+marks4+marks5+marks6)/6;

System.out.println("Average is:"+avg);

void Percentage()

int sum=(marks1+marks2+marks3+marks4+marks5+marks6);

percent=(sum*100)/600;

System.out.println("Percentage is:"+percent+"%");

void Grade()

if(percent>=75 && percent<=100)

{
System.out.println("Student is passed with Distinction");

else if(percent>=60 && percent<=74)

System.out.println("Student is passed with First class");

else if(percent>=45 && percent<=59)

System.out.println("Student is passed with Second class");

else if(percent<=44)

System.out.println("***Failed***");

public static void main(String[] args)


{

Student s = new Student();

s.Getdetails();

s.Display();

s.Total();

s.Average();

s.Percentage();

s.Grade();

OUTPUT:

C:\Users\P.C>cd desktop

C:\Users\P.C\Desktop>set path="C:\Progra

C:\Users\P.C\Desktop>javac Student.java

C:\Users\P.C\Desktop>java Student

Enter your Roll_No:

79
Enter your Name:

uzzu

Enter marks of 1st subject:

89

Enter marks of 2nd subject:

90

Enter marks of 3rd subject:

97

Enter marks of 4th subject:

78

Enter marks of 5th subject:

85

Enter marks of 6th subject:

73

***FINAL RESULT***

Roll No::79

Name::uzzu
Marks of 1st subject::89/100

Marks of 2nd subject::90/100

Marks of 3rd subject::97/100

Marks of 4th subject::78/100

Marks of 5th subject::85/100

Marks of 6th subject::73/100

Total marks is:512

Average is:85

Percentage is:85%

Student is passed with Distinction

C:\Users\P.C\Desktop>

You might also like