Java - Contoh Program Menggunakan SwitchCase

Contoh program Java menghitung huruf mutu/grade menggunakan SwitchCase.

SOURCE CODE

import java.io.*;
class SwitchCase{
    public static void main(String [] args)throws IOException
 {
 BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("=====Menghitung Grade Huruf Mutu=====");
        System.out.print("Masukkan Huruf Mutu Anda (A,B,C,D,E) : ");
        String str= input.readLine();
      
        switch (str){
        case "A":
            System.out.println("Range nilai 75 sampai 100");
            break;
        case "B":
            System.out.println("Range nilai 65 sampai 74");
            break;
        case "C":
            System.out.println("Range nilai 55 sampai 64");
            break;
        case "D":
            System.out.println("Range nilai 45 sampai 54");
            break;
        case "E":
            System.out.println("Range nilai 0 sampai 44");
            break;
        default:
            System.out.println("Data yang diinputkan salah");
        }
    }
}


OUTPUT

Terimakasih, Semoga bermanfaat

Sumber from my friend https://serverrendi.blogspot.co.id

Related Posts:

0 Response to "Java - Contoh Program Menggunakan SwitchCase"

Post a Comment