A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a Java program that determines a student’s grade
Q:

Write a Java program that determines a student’s grade

0

Write a Java program that determines a student’s grade

if the average score >=90% =>Student grade = A

if the average score >= 70% and <90% =>Student grade = B

if the average score>=50% and <70% =>Student grade = C

if the average score<50% =>Student grade = F

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..

import java.util.*;
public class JavaExcercise
{
public static void main(String[] args)
{
showGrade();
}
 
static void showGrade(){
 
    float quiz_score, mid_score,final_score,avg;
    Scanner sc=new Scanner(System.in);
    System.out.print("Enter you quiz score:");
    quiz_score=sc.nextFloat();
    System.out.print("Enter your Mid-term score:");
    mid_score=sc.nextFloat();
    System.out.print("Enter your Final score:");
    final_score=sc.nextFloat(); 
    avg=(quiz_score+mid_score+final_score)/3;
 
    if(avg>=90) System.out.println("Your grade A.");
    else if((avg>=70) && (avg<90)) System.out.println("Your grade B.");
    else if((avg>=50) && (avg<70)) System.out.println("Your grade C.");
    else if(avg<50) System.out.println("Your grade F.");
    else System.out.println("Invalid");
 
 
    }
 
}

Result:

Enter you quiz score: 80

Enter your Mid-term score: 70

Enter your Final score: 90

Your grade A.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now