Question: What is wrong with the following code? public static String grade(int score) { if (score >= 9) { return A; } else if (score >=

What is wrong with the following code? public static String grade(int score) { if (score >= 9) { return A; } else if (score >= 8) { return B; } else if (score >= 6) { return C; } else if (score >= 4) { return D; } return f; } Invalid argument in return statements No return statement for all branches of "if" statement " Invalid parameter variable type O illegal method name A programmer notices that the following code snippet uses the same algorithm for computing interest earned, but with different variables, in the two places shown below and in several other places in the program. What could be done to improve the program? final double RATE1 final double RATE2 - 5.5; double interest - investment + RATEL / 100; balance - balance + balance + RATE2 / 100; 10; Declare the rates as variables, not constants. Define a method that looks up interest rates. Define a method that prompts the user for an amount and a rate of interest, then returns the interest earned. Define a method that computes the interest earned from an amount and a rate of interest
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
