USE CASE DIAGRAM
SEQUENCE DIAGRAM
ACTIVITY DIAGRM
- Kasus 2
- Kasus 3
- Kasus 5
- Kasus 1
- Kasus 2
- Kasus 3
- Kasus 4
- Kasus 5
- Kasus 6
LISTING PROGRAM JAVA
- Kasus 1
import java.io.*;
public class satu {
public static void main(String[] args) {
System.out.println("Selamat Datang di Java Programming");
}
}
- Kasus 2
import java.io.*;
public class dua {
public static void main(String[] args) {
final int p=5;
final int l=7;
int L;
L=p*l;
System.out.println("Luas persegi panjang adalah = "+L);
}
}
- Kasus 3
import java.io.*;
public class tiga {
public static void main(String[] args) {
double f;
f=5+4-6*7/3;
System.out.println("Hasil dari perhitungan 5+4-6*7/3 adalah "+f);
}
}
- Kasus 4
import java.io.*;
public class empat {
public static void main(String[] args) {
int array[];
array = new int[5];
array[0] = 5;
array[1] = 8;
array[2] = 20;
for (int i = 0; i < 4; i++) {
System.out.println("Array[" + i + "] = " + array[i]);
}
}
}
- Kasus 5
import java.io.*;
import java.util.Scanner;
public class lima {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int luas;
System.out.print("Masukkan Panjang : ");
Integer panjang = sc.nextInt();
System.out.print("Masukkan Lebar : ");
Integer lebar = sc.nextInt();
luas = panjang * lebar;
System.out.println("Luas Persegipanjang : " + luas);
}
}
- Kasus 6
import java.io.*;
import java.util.Scanner;
public class enam {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("========== MENU ==========");
System.out.println("1. Contoh Program If then");
System.out.println("2. Contoh Program For");
System.out.println("3. Contoh Program Do-While");
System.out.print("Masukan Pilihan (1/2/3)=");
Integer pilihan = sc.nextInt();
switch (pilihan) {
case 1:
System.out.print("Masukan angka=");
Integer angka = sc.nextInt();
if (angka % 2 == 0) {
System.out.println("genap");
} else {
System.out.println("ganjil");
}
break;
case 2:
System.out.print("Masukan jumlah perulangan=");
Integer ulang = sc.nextInt();
for (int i = 1; i <= ulang; i++) {
System.out.println(i);
}
break;
case 3:
int i = 1;
System.out.print("Masukan jumlah perulangan=");
Integer ulang2 = sc.nextInt();
do {
System.out.println(i);
i++;
} while (i <= ulang2);
break;
}
}
}