can someone help me fix my code? public class Getgrades { public static void mai
ID: 3653453 • Letter: C
Question
can someone help me fix my code? public class Getgrades { public static void main(String[] args) { System.out.println("the grade for 90 is" + getGrade(90)); } public static double getGrade(int score) { double grade; if (score < 60) { grade =0.0; else if (score >= 60 && score <= 62 ) grade = 0.7; else if (score == 63 ) grade = 0.8; else if (score == 64 ) grade = 0.9; else if (score == 65 ) grade = 1.0; else if (score >= 70 && score <= 72 ) grade = 1.7; else if (score == 73 ) grade = 1.8; else if (score == 74 ) grade = 1.9; else if (score == 75 ) grade = 2.0; else if (score ==92) grade = 3.7; else if (score ==93) grade = 3.8; else if (score ==94) grade = 3.9; else grade = 4.0; return grade; } } }Explanation / Answer
Your code doesn't have any problems. But you forgot delete some code at the end after probably modifying it. I posted the correct code. Just use it. it's working. public class test { public static void main(String[] args) { System.out.println("the grade for 90 is " + getGrade(90)); } public static double getGrade(int score) { double grade; if (score < 60) grade =0.0; else if (score >= 60 && score = 70 && scoreRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.