Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Java program that takes the marks (an integer) from the user and display

ID: 3905575 • Letter: W

Question

Write a Java program that takes the marks (an integer) from the user and display the relevant grade for that marks according to the following ranges.

Your program needs to have a separate method called findGrade which takes the marks as the input value and return the relevant grade.

Marks Range Grade 80 S Marks 75 S Marks

Explanation / Answer

import java.util.Scanner; public class ConvertToGrade { static char findGrade(int marks) { if(marks >= 80) { return 'A'; } else if(marks >= 75) { return 'B'; } else if(marks >= 60) { return 'C'; } else { return 'D'; } } public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter marks: "); int marks = in.nextInt(); System.out.println("Grade is " + findGrade(marks)); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote