Q:

Java program to get student details

0

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Get and Print Student's Details program in Java

//program to get student details
import java.util.Scanner;
 
public class GetStudentDetails
{
      public static void main(String args[])
      {
          String name;
          int roll, math, phy, eng;
           
          Scanner SC=new Scanner(System.in);
           
          System.out.print("Enter Name: ");
          name=SC.nextLine();
          System.out.print("Enter Roll Number: ");
          roll=SC.nextInt();
          System.out.print("Enter marks in Maths, Physics and English: ");
          math=SC.nextInt();
          phy=SC.nextInt();
          eng=SC.nextInt();
           
          int total=math+eng+phy;
          float perc=(float)total/300*100;
           
          System.out.println("Roll Number:" + roll +"\tName: "+name);
          System.out.println("Marks (Maths, Physics, English): " +math+","+phy+","+eng);
          System.out.println("Total: "+total +"\tPercentage: "+perc);
            
      }
          
}

Output

Enter Name: Mike
Enter Roll Number: 101
Enter marks in Maths, Physics and English: 88 77 99
Roll Number:101	Name: Mike
Marks (Maths, Physics, English): 88,77,99
Total: 264	Percentage: 88.0

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Core Java Example programs for Beginners and Professionals

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Java program to get current system date and time... >>
<< Java program to get Host Name by IP Address...