Anda di halaman 1dari 1

1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

import java.util.Scanner;
public class Driver1103132171 {
public static void main(String[] args) {
int x=0;
String namatmp;
Scanner sc = new Scanner(System.in);
Mahasiswa1103132171 mhs = new Mahasiswa1103132171();
while (x != 4) {
System.out.println("Menu :");
System.out.println("1. Tambah Objek Mahasiswa");
System.out.println("2. Input Data Objek Mahasiswa");
System.out.println("3. View Data Mahasiswa");
System.out.println("4. Keluar");
System.out.print("Masukkan Pilihan : ");
x = sc.nextInt();
switch (x) {
case 1 :
mhs = new Mahasiswa1103132171();
break;
case 2 :
System.out.print("Masukkan Nama : ");
mhs.setNama(sc.next());
System.out.print("Masukkan NIM : ");
mhs.setNim(sc.next());
System.out.print("Masukkan Nilai UTS : ");
mhs.setUts(sc.nextDouble());
System.out.print("Masukkan Nilai UAS : ");
mhs.setUas(sc.nextDouble());
System.out.print("Masukkan Nilai Tugas : ");
mhs.setTugas(sc.nextDouble());
break;
case 3 :
String data = mhs.toString();
System.out.println(data);
break;
}
}
}
}