write a program to store the name and marks of four subjects like computer history chemistry and biology find and print the summation and average marks and the name of the student in blue j
Answers
import java.util.*;
public class StudentInfo
{
public static void main (String args[])
{
String studentName , student class ;
int computer , history , chemistry , biology ;
double totalMarks , avg;
Scanner sc = new Scanner (System.in);
System.out.println("Enter Student 's Name : ");
studentName = sc.nextLine();
System.out.println("Enter Marks Of Computer");
computer = sc.nextInt();
System.out.println("Enter Marks Of History");
history = sc.nextInt();
System.out.println("Enter Marks Of Chemistry");
chemistry = sc.nextInt();
System.out.println("Enter Marks Of Biology");
biology = sc.nextInt();
totalMarks = computer + history + chemistry + biology;
avg = totalMarks/4;
System.out.println("Student's Name : "+ studentName);
System.out.println("Marks : "+computer+" , "+history+" , "+chemistry+" , "+biology);
System.out.println("Total Marks : "+totalMarks);
System.out.println("Average : "+avg);
sc.close();
}
}