Java Program to calculate and display Student Grades
Search Results
Web results
Java Program to calculate and display Student Grades
Program to input roll number of a student ,marks in three subjects.Calculate total marks and percentage.Print the output using all input data and calculated data with proper headings
import java.util.*;
class
Student
{
public static void main()
{ {
public static void main()
Scanner Sc=new Scanner(System.in); System.out.println(“Enter roll no “);
int roll=Sc.nextInt();
System.out.println(“Enter the marks in three subjects and fullmarks “);
double m1=Sc.nextDouble();
double m2=Sc.nextDouble();
double m3=Sc.nextDouble();
double fullmark=Sc.nextDouble();
{
double total=m1+m2+m3;
double percent=total/fullmark*100; }
{ System.out.println(“Roll number: “+roll); }
{ System.out.println(“Marks in first subject: “+m1); }
{ System.out.println(“Marks in second subject: “+m2); }
{ System.out.println(“Marks in third subject: “m3); }
{ System.out.println(“Total marks scored: “+total); }
{ System.out.println(“Percentage scored: “+percent);
} } }
Output: Enter roll no 11
Enter the marks in three subjects and fullmarks 80 80 90
Roll number: 11
Marks in first subject: 80
Marks in second subject: 80
Marks in third subject: 90
Total marks scored: 250
Percentage scored:83.33
Thanks for viewing Java Program to calculate and display Student Grades
--------------------------------------------------------------------------------
Just copy paste the code into the class file of Bluej compiler. Change the class name according to your's.
Thanks for visting Programming in JAVA
Happy Coding !!
please i want six subject detail
ReplyDeletewrite a class in java that allows the user to input the roll number , name and marks of an mcs student in six subjects(oop, ddbs,datacom, softwareEng, webprog,data structure)via a method inputdata maximum 100 marks.
DeleteJust add three more variables. (total 6 variables for 6 subjects). Then add them to get total marks. AND then find the percentage.First try it with yourself.
ReplyDeleteThank You.