Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
0 like 0 dislike
29.6k views
in JECRC University B.Tech(CSE-V Sem) Java Programming Lab by Goeduhub's Expert (5.8k points)

Given the following attributes: Regno(int), Name(string), Marks in subjects(Integer Array), Total (int)

Goeduhub's Top Online Courses @Udemy

For Indian Students- INR 360/- || For International Students- $9.99/-

S.No.

Course Name

 Coupon

1.

Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence || Labeled as Highest Rated Course by Udemy

Apply Coupon

2.

Complete Machine Learning & Data Science with Python| ML A-Z Apply Coupon

3.

Complete Python Programming from scratch | Python Projects Apply Coupon
    More Courses

1 Answer

0 like 0 dislike
by Goeduhub's Expert (5.8k points)
edited by
 
Best answer

Program Code

import java.io.*;

import java.util.*;

class Student

{

   Scanner sc=new Scanner(System.in);

   int RegNo,Total=0,subjects;

   String name;

   int marks[];

   Student()

   {

      System.out.print("Enter Registration No.: ");

      RegNo=sc.nextInt();

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

      name=sc.next();;

      getDisMarks();

   }

   public void getDisMarks()

   {

       marks=new int[3];

       System.out.print("Enter marks of Physics: ");

       marks[0]=sc.nextInt();

       System.out.print("Enter marks of Chemistry: ");

       marks[1]=sc.nextInt();

       System.out.print("Enter marks of Maths: ");

       marks[2]=sc.nextInt();

       for(int i=0;i<3;i++)

       {

          Total+=marks[i];

       }

       System.out.println("Total Marks of student "+name+": " +Total);

   }

}

class StudentDemo

{

    public static void main(String args[])

    {

        Student s[]=new Student[5];

        for(int i=0;i<5;i++)

              s[i]=new Student();

     }

}

Output

Enter Registration No.: 624

Enter Student Name: Ankit

Enter marks of Physics: 95

Enter marks of Chemistry: 94

Enter marks of Maths: 95

Total Marks of student Ankit: 284

Enter Registration No.: 527

Enter Student Name: Aditya

Enter marks of Physics: 97

Enter marks of Chemistry: 93

Enter marks of Maths: 89

Total Marks of student Aditya: 279

Enter Registration No.: 093

Enter Student Name: Namrata

Enter marks of Physics: 85

Enter marks of Chemistry: 90

Enter marks of Maths: 95

Total Marks of student Namrata: 270

Enter Registration No.: 123

Enter Student Name: Unknown

Enter marks of Physics: 69

Enter marks of Chemistry: 79

Enter marks of Maths: 89

Total Marks of student Unknown: 237

Enter Registration No.: 789

Enter Student Name: Known

Enter marks of Physics: 75

Enter marks of Chemistry: 65

Enter marks of Maths: 24

Total Marks of student Known: 164


For more JU V Sem Java Lab Experiments Click here


3.3k questions

7.1k answers

394 comments

4.6k users

Related questions

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 
...