0% found this document useful (0 votes)
53 views1 page

String: Import Public Class Public Static Void Int

This Java code defines a class called Driver1103132171 with a main method that acts as a menu-driven program for managing Mahasiswa1103132171 objects. The menu allows the user to 1) create a new Mahasiswa object, 2) input data like name, ID number, and test scores for an object, or 3) view the data of the current object. Based on the user's selection, it either instantiates a new Mahasiswa object, prompts for input and calls setter methods, or prints the object's details via its toString method.

Uploaded by

ignatiusniko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views1 page

String: Import Public Class Public Static Void Int

This Java code defines a class called Driver1103132171 with a main method that acts as a menu-driven program for managing Mahasiswa1103132171 objects. The menu allows the user to 1) create a new Mahasiswa object, 2) input data like name, ID number, and test scores for an object, or 3) view the data of the current object. Based on the user's selection, it either instantiates a new Mahasiswa object, prompts for input and calls setter methods, or prints the object's details via its toString method.

Uploaded by

ignatiusniko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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;
}
}
}
}

You might also like