Programming Shortcut - c, c++, java, SQL, online tutorials
No Result
View All Result
  • Home
  • About us
  • Programs in c
  • Programs in cpp
  • Programs in java
  • .Net
  • Privacy Policy
  • Contact Us
  • Home
  • About us
  • Programs in c
  • Programs in cpp
  • Programs in java
  • .Net
  • Privacy Policy
  • Contact Us
No Result
View All Result
Programming Shortcut - c, c++, java, SQL, online tutorials
No Result
View All Result
Home Programming Language

Program to find out code of grade and percentage calculator in Java

In this program we calculate grade and percentage of a students according to 6 subjects marks by the given below methods by if else loop concepts basic to advance loop in java code

admin by admin
April 5, 2022
Reading Time:2min read
0
Program to find out code of grade and percentage calculator in Java

Program to find out code of grade and percentage calculator in Java

Program to find out code of grade and percentage calculator in java of a student when the marks of 6 subjects are given.

In this program, we calculate the grade and percentage of students according to 6 subjects marks by the given below methods by if-else loop concepts basic to advance loop in java
best if else if loop example with explanation

RELATED POSTS

Armstrong number in c

Program to find out the grade and percentage calculator in cpp

Program to find out the grade and percentage calculator in c

The method of assigning grades is –
percentage>=85 grade=A
percentage<85 and percentage>=70 grade=B
percentage<70 and percentage>=55 grade=C
percentage<55 and percentage>=40 grade=D
percentage<40 grade=E

 

import java.util.Scanner;
public class Percentagefile {public static void main(String[] args) {
float m1, m2, m3, m4, m5, m6, total, percentage;
char grade = ‘Z’;
Scanner in = new Scanner(System.in);System.out.println(“Please enter marks out 100 of Subject 1”);
m1 = in.nextInt();
System.out.println(“Please enter marks out 100 of Subject 2”);
m2 = in.nextInt();
System.out.println(“Please enter marks out 100 of Subject 3”);
m3 = in.nextInt();
System.out.println(“Please enter marks out 100 of Subject 4”);
m4 = in.nextInt();
System.out.println(“Please enter marks out 100 of Subject 5”);
m5 = in.nextInt();
System.out.println(“Please enter marks out 100 of Subject 6”);
m6 = in.nextInt();
// Total all 6 subject marks
total = m1 + m2 + m3 + m4 + m5 + m6;
// Calculate percentage of All Subject
percentage = total / 6;
if (percentage > 33 && percentage < 100) {
if (percentage >= 100) {
System.out.println(“Your percentage is invaild.”);
} else if (percentage >= 85) {
grade = ‘A’;
} else if (percentage >= 70) {
grade = ‘B’;
} else if (percentage >= 55) {
grade = ‘C’;
} else if (percentage >= 40) {
grade = ‘D’;
} else {
grade = ‘E’;
}
System.out.println(“Your score ” + percentage + “% and your grade is ” + grade + “”);
} else {
System.out.println(“You are Fail or You Enter Invaild Marks”);
}
}
}

Suppose Student S1 finds the following marks:
Subject 1=70, Subject 2 =50, Subject 3 = 80,
Subject 4 = 76, Subject 5 = 56, Subject 6 = 78,

output:

Please enter marks out 100 of Subject 1
70
Please enter marks out 100 of Subject 2
50
Please enter marks out 100 of Subject 3
80
Please enter marks out 100 of Subject 4
76
Please enter marks out 100 of Subject 5
56
Please enter marks out 100 of Subject 6
78
Your score 68.333336% and your grade is C

BUILD SUCCESSFUL (total time: 15 seconds)

I make this programming and hope you are like the post if are you like the post you can please comment and share the post to reach more people.
If any doubt about this java programming code or input & output please comment below
If you have another question about java programming send an email by contacting us form is given on the page right side.

Same Percentage Program Code in C language
Same Percentage Program Code in C++ language
Share your experience with this post,
Thank You!

Tags: grade calculatorJavajava codepercentage calculator
ShareTweetPin
admin

admin

Related Posts

Programming Language

Armstrong number in c

November 12, 2022
Program to find out the grade and percentage calculator in cpp
Programming Language

Program to find out the grade and percentage calculator in cpp

March 7, 2022
Program to find out the grade and percentage calculator in c
Programming Language

Program to find out the grade and percentage calculator in c

March 6, 2022
Programs in java

Java program to find quotient and remainder

April 21, 2020
Programs in java

Java program to solve mathematical expressions

April 21, 2020
Programming Language

Difference and similarities between java and c++

April 3, 2022
Next Post

Armstrong number in c

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Popular Stories

  • Short name by java program

    0 shares
    Share 0 Tweet 0
  • Relation of two numbers in c programming

    0 shares
    Share 0 Tweet 0
  • Bigger and smaller number in c programming

    0 shares
    Share 0 Tweet 0
  • Bigger and smaller number in c++

    0 shares
    Share 0 Tweet 0
  • Java program to perform sum of digits until single digit is obtained

    0 shares
    Share 0 Tweet 0
ADVERTISEMENT
C, C++ & Java Programming tutorial with example Programming Shortcut

Hi Friends, Programming Shortcut is Educational Blog, that From you Learn Programming in Multiple languages like C, C++, Java Programming Language.

LEARN MORE »

Recent Posts

  • Armstrong number in c
  • Program to find out code of grade and percentage calculator in Java
  • Program to find out the grade and percentage calculator in cpp

Categories

  • .Net
  • Programming Language
  • Programs in c
  • Programs in cpp
  • Programs in java
  • Uncategorized

All © 2021 Programming Shortcut - Present By Math Training.

No Result
View All Result
  • Home
  • About us
  • Programs in c
  • Programs in cpp
  • Programs in java
  • .Net
  • Privacy Policy
  • Contact Us

All © 2021 Programming Shortcut - Present By Math Training.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.