[go: up one dir, main page]

0% found this document useful (0 votes)
481 views3 pages

Student Marksheet Calculation Program

This Java program calculates student marks and averages for a single student. It defines a Student class with methods to get student data through input, calculate total and average marks, and display the results. The main method creates a Student object, calls the getdata, calculate, and display methods to retrieve input, perform calculations, and output the student name, roll number, individual subject marks, total, and average.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
481 views3 pages

Student Marksheet Calculation Program

This Java program calculates student marks and averages for a single student. It defines a Student class with methods to get student data through input, calculate total and average marks, and display the results. The main method creates a Student object, calls the getdata, calculate, and display methods to retrieve input, perform calculations, and output the student name, roll number, individual subject marks, total, and average.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

STUDENT MARKSHEET CALCULATION PROGRAM

import java.util.*;
class Student //classname
{
    //The following are instance variables
    String name;
    int roll_num,m1,m2,m3,t;
    float a;
    //The following is 'Scanner'class to get input from a user
    Scanner s = new Scanner(System.in);
    //The following are  implementation of methods
    void getdata()
    {
        System.out.println("Enter Student Name:");
        name=s.nextLine();
        System.out.println("Enter Student Rollno:");
        roll_num=s.nextInt();
        System.out.println("Enter Student's Tamil mark:");
        m1=s.nextInt();
        System.out.println("Enter Student's English mark:");
        m2=s.nextInt();
        System.out.println("Enter Student's Computer Science mark:");
        m3=s.nextInt();
    }
    void calculate()
    {
        t=m1+m2+m3;
        a=t/3;
    }
    void display()
    {
        System.out.println("Student Name Is:"+name);
        System.out.println("Student Rollno  Is:"+roll_num);
        System.out.println("Student's Tamil mark Is:"+m1);
        System.out.println("Student's English mark Is:"+m2);
        System.out.println("Student's Computer Science mark Is:"+m3);
        System.out.println("Student's Total Is:"+t);
        System.out.println("Student's Average  Is:"+a);
    }

    //The program starts from here


    public static void main(String  args[])
    {
        System.out.println("STUDENT MARKSHEET CALCULATION");
        System.out.println("******* ********* ***********");
        //The following is the object creation syntax
        Student Student1 = new  Student();
        Student1.getdata();
        Student1.calculate();
        Student1.display();
    }
}

OUTPUT:
STUDENT MARKSHEET CALCULATION
******* ********* ***********
Enter Student Name:
Hari Prakash
Enter Student Rollno:
19
Enter Student's Tamil mark:
95
Enter Student's English mark:
90
Enter Student's Computer Science mark:
100
Student Name Is:Hari Prakash
Student Rollno Is:19
Student's Tamil mark Is:95
Student's English mark Is:90
Student's Computer Science mark Is:100
Student's Total Is:285
Student's Average Is:95.0

You might also like