Advertisement
kuchuz

PBO-C 2 : MainProfile()

Oct 15th, 2020
2,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main extends Profil{
  3.     public static void main (String[] args) {
  4.         System.out.println ("Welcome!");
  5.         System.out.println ("1. Tampilkan Profil");
  6.         System.out.println ("2. Quit");
  7.  
  8.         Scanner scan = new Scanner(System.in);
  9.         while(scan.hasNext()) {
  10.             String pilihan = scan.nextLine();
  11.             if (pilihan.equals("1")){
  12.                 Profil profil = new Profil ();
  13.                 System.out.println ("Nama\t\t:"+ profil.getNama());
  14.                 System.out.println ("NRP\t\t:"+ profil.getNRP());
  15.                 System.out.println ("Alamat\t\t:"+ profil.getAlamat());
  16.                 System.out.println ("Departmen\t:"+ profil.getDepartemen());
  17.                 System.out.println ("Angkatan\t:"+ profil.getAngkatan());
  18.                 System.out.println ("Kelas\t\t:"+ profil.getKelas());
  19.             }
  20.             else if (pilihan.equals("2")){
  21.                 System.out.println("Done !");
  22.                 scan.close();
  23.                 System.exit(0);
  24.             }else{
  25.                 System.out.println("Wrong Command");
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement