Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class operWhen {
- public static void main(String[] args) {
- char texts;
- String text;
- boolean check, cheque;
- Scanner entry = new Scanner(System.in);
- System.out.print("Your Value A to E: ");
- text = entry.nextLine(); // String
- texts = text.charAt(0); // String to Char
- check = Character.isLetter(texts); // Char to Boolean
- if (check == true) {
- switch (text) {
- case "A":
- System.out.println("CUM LAUDE");
- break;
- case "B":
- System.out.println("GOOD");
- break;
- case "C":
- System.out.println("ENOUGH");
- break;
- case "D":
- System.out.println("GRADUATE");
- break;
- case "E":
- System.out.println("NOT GRADUATE");
- break;
- }
- } else {
- System.out.println("F A L S E");
- }
- }
- }
Add Comment
Please, Sign In to add comment