Hi all
I'm having problems with week 1 exercise 18 on course Grades and Points.
So the problem I having is understanding what code needs to be implemented. I understand what the question is asking me to do but, I dont what code I should implement.
Reading from other posts about this exercise, it looks like the starting code should be something like this:
if (num1 >= 0 && num1 <= 20) {
System.out.println("Failed");
But I have done something totally different:
import java.util.Scanner;
public class GradesAndPoints {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.print("Type the points [0-60]:");
int number = Integer.parseInt(reader.nextLine());
if (number == 29) {
System.out.println("Failed");
} else if (number == 34) {
System.out.println("Grade: 1");
} else if (number == 39) {
System.out.println("Grade: 2");
} else if (number == 44) {
System.out.println("Grade: 3");
} else if (number == 49) {
System.out.println("Grade: 4");
} else if (number == 60) {
System.out.println("Grade: 5");
}
}
}
Its very frustrating for a newbie like me to overcome problems like this even at the beginning of this course. but I really want to understand how to code. Was there an example prior to this that explains how to compare with the && operators or other tips that can help me understand this a bit better?