[Asking smart questions] [About Bear] [Books by Bear]
Molayo Decker wrote:Hi Serkan I think you can also use the if (condition){} for this If x =>90<=100 system.out,println("A") else
Ronald Zet wrote: public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter your score here: "); int score = in.nextInt(); String grade; switch (score / 10) { case 10: case 9: grade = "A"; break; case 8: grade = "B"; break; case 7: grade = "C"; break; case 6: grade = "D"; break; default: grade = "F"; break; } System.out.println("Your grade is " + grade); } Looks shorter, huh? At least, it should fit A4 "paper"
Ronald Zet wrote:. . .At least, it should fit A4 "paper"