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

Make a program to find the grade of the student with the following conditions: I

ID: 3582752 • Letter: M

Question

Make a program to find the grade of the student with the following conditions: Input using class Scanner from java.util.Scanner. The program begins by asking for five inputs below: First input is student's name in the form of String. Second input is gender in the form of boolean, where is true = male and false = female. Third input is Mid Exam score with range between 0 until 100 in the form of int. Fourth input is Final Exam score with range between 0 until 100 in the form of int. Fifth input is Independent Task score with range between 0 until 100 in the form of int. Final score calculating with percentage 30 % Mid Exam, 50% Final Exam and 20% Independent Task. Grade calculating is obtained from final score with the following conditions: Grade A: final score >= 85 Grade B: 75

Explanation / Answer

package org.students;

import java.util.ArrayList;
import java.util.Scanner;

public class Test {


   public static void main(String[] args) {
  
       //Declaring variables
       String name;
       boolean gender;
       int mid_exam,final_exam,task_score;
       double final_score;
       char grade = 0;
      
       //Scanner class object is used to read the inputs entered by the user
       Scanner sc=new Scanner(System.in);
System.out.println("Calculating the Score Program");
System.out.println("========================");
  
//Getting the name entered by the user
System.out.print(" Input Your Name :");
name=sc.nextLine();
  
//Getting the gender entered by the user
System.out.print("Input gender (true=Male / false=Female) :");
gender=sc.nextBoolean();
  
  
//This loop continues to execute until the user enters Valid mid score
while(true)
{
  
   //Getting the mid score entered by the user
System.out.print("Input your Mid Exam Score (0..100) :");
mid_exam=sc.nextInt();
if(mid_exam<0 || mid_exam>100)
{
   //Displaying the error message
   System.out.println("** Invalid.Must be between (0-100) **");
   continue;
}
else
   break;
}
  
//This loop continues to execute until the user enters Valid Exam score
while(true)
{
   //Getting the exam score entered by the user
   System.out.print("Input your Final Exam Score (0..100) :");
final_exam=sc.nextInt();
if(final_exam<0 || final_exam>100)
{
   //Displaying the error message
   System.out.println("** Invalid.Must be between (0-100) **");
   continue;
}
else
   break;
}
  
//This loop continues to execute until the user enters task score
while(true)
{
   //Getting the task score entered by the user
   System.out.print("Input your Independent Task Score Score (0..100) :");
task_score=sc.nextInt();
if(task_score<0 || task_score>100)
{
    //Displaying the error message
   System.out.println("** Invalid.Must be between (0-100) **");
   continue;
}
else
   break;
}
  
  
//calculating the final score
final_score=mid_exam*0.3+final_exam*0.5+task_score*0.2;
  
//Displaying the final score
System.out.println("Your Score :"+final_score);
  
//Finding the grade based on the final score
if(final_score>=85)
grade='A';
else if(final_score>=75 && final_score<85)
grade='B';
else if(final_score>=65 && final_score<75)
grade='C';
else if(final_score>=55 && final_score<65)
grade='D';
else if(final_score<55)
grade='E';
  
//Based on the grade displaying the message
System.out.println("Your Grade is :"+grade);
if(grade=='A')
   System.out.print("Very good keep your grade");
else if(grade=='B')
   System.out.print("Pretty good, increase again");
if(grade=='C')
   System.out.print("Quite less,need to learn more");
if(grade=='D')
   System.out.print("Your score is not satisfy");
if(grade=='E')
   System.out.print("Learn more diligent and active");

  
if(gender==true)
   System.out.print(" Mr.");
else
   System.out.print(" Mrs.");

System.out.println(name);
   }

}

______________________

Output:

Calculating the Score Program
========================

Input Your Name :Sizuka
Input gender (true=Male / false=Female) :false
Input your Mid Exam Score (0..100) :100
Input your Final Exam Score (0..100) :90
Input your Independent Task Score Score (0..100) :95
Your Score :94.0
Your Grade is :A
Very good keep your grade Mrs.Sizuka

_________Thank You

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