diff --git a/README.md b/README.md index f859e46..219c974 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Lab OOP -Repository tempat pengumpulan tugas untuk Lab OOp +# Lab-OOP +Repository tempat pengumpulan tugas untuk Praktikan Lab OOP Sistem Informasi 2022 ## Aturan Pengumpulan **Note:** @@ -11,18 +11,30 @@ _Untuk perintah yang dibungkus < > maka perintah tersebut diganti sesuai instruk ``` - Pindah ke repositori hasil clone dengan perintah berikut ``` - cd lab-oop/src/ + cd Lab-OOP ``` -- Buat branch baru berdasarkan NIM kalian serta gunakan branch tersebut untuk menyimpan kode dari soal yang dikerjakan +- Pindah ke branch NIM kalian serta gunakan branch tersebut untuk menyimpan kode dari soal yang dikerjakan ``` - git checkout -b + git checkout ``` -- Buat folder baru berdasarkan NIM kalian +- Buat folder baru berdasarkan NIM kalian di dalam folder `src` ``` + cd src mkdir ``` -- Di dalam folder NIM kalian buat folder dengan nama "Pertemuan_<_no_pertemuan_>" tanpa tanda kutip. contoh: Pertemuan_01 -- Di dalam folder pertemuan tersebut, kalian menambahkan file tugas praktikum yang telah kalian kerjakan dengan format nama file "assignment_<_no pertemuan_>_<_no_soal_>.java" tanpa tanda kutip +- Di dalam folder NIM kalian buat folder dengan nama "Pertemuan_<_no_pertemuan_>" tanpa tanda kutip. contoh: Pertemuan_1 +- Di dalam folder pertemuan tersebut, kalian menambahkan file tugas praktikum yang telah kalian kerjakan dengan format nama file "No<_no_soal_>.java" tanpa tanda kutip. Contoh: No1.java +- Perhatikan bahwa disetiap filenya kalian harus menambahkan packagenya di awal file tersebut. Dimana nama package nantinya harus sesuai dengan folder dimana file tersebut berada di dalma folder `src`. +Contoh: +``` +package H071191049.Pertemuan_1 + +public class Main{ + .... + ... +} +``` +berarti file di atas berada di folder `src/H071191049/Pertemuan_1`. Untuk contoh detailnya bisa dilihat di file `src/H071191049/Pertemuan_1/Main.java` dan `src/H071191049/Pertemuan_1/my_package/Person.java` - Setelah semua file tugas telah diselesaikan dan telah diasistensikan lakukan perintah berikut ``` git add . @@ -31,7 +43,7 @@ _Untuk perintah yang dibungkus < > maka perintah tersebut diganti sesuai instruk ``` Note: Pesan commit yang dibuat diharapkan sesuai dengan hal yang dilakukan. Seperti "menambah tugas praktikum ..." atau "memperbaiki type di file ..." -- Setiap file wajib menggunakan package, dengan format misal nim anda H071191049 dan Tugasnya merupakan tugas Pertemuan_02, maka packagenya - ```package H071191049.Pertemuan02``` -- Setelah perintah tersebut berhasil, silahkan membuka repository hasil fork kalian di github dan lakukan pull request ke repository ini. +- Setelah perintah tersebut berhasil, silahkan membuka repository hasil fork kalian di github dan lakukan pull request ke repository ini. +- Pastikan base branch sama dengan branch NIM kalian +![panduan pull request](https://i.ibb.co/XtWGrS6/Panduan-pull-request.png) - Apabila terdapat kesulitan, silahkan menghubungi asistennya diff --git a/src/H071221099/Pertemuan_1/No1.java b/src/H071221099/Pertemuan_1/No1.java new file mode 100644 index 0000000..e15a0d4 --- /dev/null +++ b/src/H071221099/Pertemuan_1/No1.java @@ -0,0 +1,22 @@ +package H071221099.Pertemuan_1; + +import java.util.Scanner; + +class No1 { + public static void main(String[] args) { + String nim; + Scanner keyboard = new Scanner (System.in); + System.out.print("Masukkan NIM: "); + nim = keyboard.next(); + String inp = nim.substring(nim.length()-3); + + int angka = Integer.parseInt(inp); + + if (angka % 7 == 0) { + System.out.println("Soal: no 7"); + } else { + System.out.printf("Soal: no %d\n", angka % 7); + } + keyboard.close(); + } +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_1/No2.java b/src/H071221099/Pertemuan_1/No2.java new file mode 100644 index 0000000..3c1d82f --- /dev/null +++ b/src/H071221099/Pertemuan_1/No2.java @@ -0,0 +1,41 @@ +package H071221099.Pertemuan_1; + +import java.util.Scanner; + +public class No2 { + + public static void main(String[] args) { + Scanner inp = new Scanner(System.in); + try { + System.out.print("Masukkan jumlah bilangan: "); + int number = inp.nextInt(); + + int desimal = 0; + int bulat = 0; + + for (int i = 0; i < number; i++) { + // Arti dari perulangan ini adalah "untuk nilai awal i sama dengan 0; lakukan + // perintah di dalam blok perulangan ini selama i kurang dari nilai n; + // setiap kali perintah-perintah di dalam blok perulangan selesai dieksekusi, + // tambahkan 1 ke nilai i". + // Dalam konteks ini, n adalah sebuah variabel atau konstanta yang menyatakan + // jumlah iterasi atau pengulangan yang ingin dilakukan. + + // System.out.print("Masukkan bilangan ke-" + (i + 1) + ": "); + double ngka = inp.nextDouble(); + + if (ngka % 1 == 0) { + bulat++; + } else { + desimal++; + } + } + + System.out.println(bulat + " Bilangan Bulat"); + System.out.println(desimal + " Bilangan Desimal"); + inp.close(); + } catch (Exception e) { + System.out.println("Hanya bisa menerima angka"); + } + } +} diff --git a/src/H071221099/Pertemuan_1/No3.java b/src/H071221099/Pertemuan_1/No3.java new file mode 100644 index 0000000..ab5802d --- /dev/null +++ b/src/H071221099/Pertemuan_1/No3.java @@ -0,0 +1,22 @@ +package H071221099.Pertemuan_1; + +import java.util.Scanner; + +public class No3 { + public static void main(String[] args) { + Scanner inp = new Scanner(System.in); + try { + System.out.print("Name : "); + String a = inp.nextLine(); + System.out.print("Umur : "); + int b = inp.nextInt(); + inp.nextLine(); + System.out.print("Hobby : "); + String c = inp.nextLine(); + System.out.println("Nama Saya " + a + ", " + b + " Tahun, " + "Hobby " + c); + } catch (Exception e) { + System.out.println("inputan umur harus berupa angka"); + } + inp.close(); + } +} diff --git a/src/H071221099/Pertemuan_1/No4.java b/src/H071221099/Pertemuan_1/No4.java new file mode 100644 index 0000000..87f8ceb --- /dev/null +++ b/src/H071221099/Pertemuan_1/No4.java @@ -0,0 +1,34 @@ +package H071221099.Pertemuan_1; + +import java.util.Scanner; + +public class No4 { + public static void main(String[] args) { + Scanner inp = new Scanner(System.in); + System.out.print("Masukkan kalimat: "); + String kalimat = inp.nextLine(); // kucing + String[] kata = kalimat.toLowerCase().split(" "); + String kalimatBaru = ""; + for (int i = 0; i < kata.length; i++) { + kalimatBaru += kata[i].substring(0, 1).toUpperCase() + kata[i].substring(1).toLowerCase() + " "; + } + // 'kata' adalah sebuah string yang berisi beberapa kata yang dipisahkan oleh + // spasi. + // 'i' adalah sebuah variabel yang digunakan untuk mengakses setiap kata pada + // string 'kata' satu per satu, dimulai dari indeks ke-0. + // 'substring(0, 1)' digunakan untuk memilih karakter pertama dari setiap kata + // pada string 'kata'. + // 'toUpperCase()' digunakan untuk mengubah karakter pertama menjadi huruf + // kapital. + // 'substring(1)' digunakan untuk memilih karakter-karakter setelah karakter + // pertama pada setiap kata. + // '+ " "' digunakan untuk menambahkan spasi setelah setiap kata yang sudah + // diubah huruf kapital pada string 'Baru'. + // Hasil akhir dari perintah ini adalah sebuah string baru 'Baru' yang berisi + // setiap kata pada string 'kata' dengan huruf pertama yang diubah menjadi huruf + // kapital dan dipisahkan oleh spasi. + + System.out.println(kalimatBaru); + inp.close(); + } +} diff --git a/src/H071221099/Pertemuan_1/No5.java b/src/H071221099/Pertemuan_1/No5.java new file mode 100644 index 0000000..8867f8b --- /dev/null +++ b/src/H071221099/Pertemuan_1/No5.java @@ -0,0 +1,67 @@ +package H071221099.Pertemuan_1; + +import java.util.Scanner; + +public class No5 { + public static void main(String[] args) { + Scanner inp = new Scanner(System.in); + String hari, angkaBulan, tahun, tanggal, angkaTahun; + String namaBulan=""; + System.out.print("Input: "); + tanggal = inp.nextLine(); + hari = tanggal.substring(0, 1); + angkaBulan = tanggal.substring(3, 5); + tahun = tanggal.substring(6, 8); + + if (Integer.parseInt(tahun) > 23) { + angkaTahun = "19"+tahun; + }else { + angkaTahun = "20"+tahun; + } + inp.close(); + + + switch (Integer.parseInt(angkaBulan)) { + case 1: + namaBulan = "Januari"; + break; + case 2: + namaBulan = "Februari"; + break; + case 3: + namaBulan = "Maret"; + break; + case 4: + namaBulan = "April"; + break; + case 5: + namaBulan = "Mei"; + break; + case 6: + namaBulan = "Juni"; + break; + case 7: + namaBulan = "July"; + break; + case 8: + namaBulan = "Agustus"; + break; + case 9: + namaBulan = "September"; + break; + case 10: + namaBulan = "Oktober"; + break; + case 11: + namaBulan = "November"; + break; + case 12: + namaBulan = "Desember"; + break; + default: + System.out.println("Angka yang dimasukkan tidak valid"); + break; + } + System.out.println(Integer.parseInt(hari)+" "+namaBulan+" "+angkaTahun); + } +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_1/No6.java b/src/H071221099/Pertemuan_1/No6.java new file mode 100644 index 0000000..bf36d2b --- /dev/null +++ b/src/H071221099/Pertemuan_1/No6.java @@ -0,0 +1,20 @@ +package H071221099.Pertemuan_1; + +import java.util.Scanner; + +public class No6 { + public static void main(String[] args) { + Scanner inp = new Scanner(System.in); + try { + System.out.print("Masukkan jari-jari lingkaran: "); + double jariJari = inp.nextDouble(); + + double luasLingkaran = Math.PI * Math.pow(jariJari, 2); + System.out.printf("Luas lingkaran adalah: %.2f ", luasLingkaran); + } catch (Exception e) { + System.out.println("Hanya menerima angka"); + } + inp.close(); + } + +} diff --git a/src/H071221099/Pertemuan_1/No7.java b/src/H071221099/Pertemuan_1/No7.java new file mode 100644 index 0000000..8bafbfa --- /dev/null +++ b/src/H071221099/Pertemuan_1/No7.java @@ -0,0 +1,31 @@ +package H071221099.Pertemuan_1; + +import java.util.Scanner; + +public class No7 { + static String[] hewan = { "Singa", "Monyet", "Kucing", "Cheetah", "Anjing", "Semut", "Cicak", "Gajah", + "Kerbau", "Burung", "Kambing" }; + + public static void main(String[] args) { + Scanner inp = new Scanner(System.in); + System.out.print("Masukkan Kata Kunci: "); + String inputHewan = inp.next(); + int indexHewan = findIndex(inputHewan); + System.out.println(indexHewan); + inp.close(); + } + + static int findIndex(String inputHewan) { + // inputHewan = inputHewan.toLowerCase(); + int result = -1; + for (int i = 0; i < hewan.length; i++) { + String hewan1 = hewan[i]; + // hewan1 = hewan1.toLowerCase(); + if (hewan1.equalsIgnoreCase(inputHewan)) { + result = i ; + } + } + return result; + } + +} diff --git a/src/H071221099/Pertemuan_1/No8.java b/src/H071221099/Pertemuan_1/No8.java new file mode 100644 index 0000000..1f11ee8 --- /dev/null +++ b/src/H071221099/Pertemuan_1/No8.java @@ -0,0 +1,33 @@ +package H071221099.Pertemuan_1; + +import java.util.Scanner; + +public class No8 { + public static void main(String[] args) { + int[][] angka = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9, }, { 10, 11 }, { 12 }, { 13, 14, 15, 16 } }; + Scanner inp = new Scanner(System.in); + + try { + System.out.print("Input angka yang ingin di cari : "); + int inputAngka = inp.nextInt(); + // angka[0][0] + // angka[0][1] + // angka[0][2] + // angka[1][0] + // angka[0] + for (int i = 0; i < angka.length; i++) { + for (int j = 0; j < angka[i].length; j++) { + int angka1 = angka[i][j]; + if (angka1 == inputAngka) { + System.out.println("Found " + inputAngka + " at [" + i + "][" + j + "]"); + + } + } + } + + } catch (Exception e) { + System.out.println("Input harus berupa data integer (angka)"); + } + inp.close(); + } +} diff --git a/src/H071221099/Pertemuan_2/No1.java b/src/H071221099/Pertemuan_2/No1.java new file mode 100644 index 0000000..bee8f65 --- /dev/null +++ b/src/H071221099/Pertemuan_2/No1.java @@ -0,0 +1,32 @@ +class Ichitan{ + String rasa; + int harga; + String colour; + + public String getRasa () { + return rasa; + } + + public int getHarga () { + return harga; + } + + public String getColour () { + return colour; + } +} + +public class No1 { + public static void main(String[] args) { + Ichitan drnk = new Ichitan(); + drnk.rasa = "GreenTea"; + drnk.colour = "hijau"; + drnk.harga = 9700; + + System.out.println("hmm rasanya seperti " + drnk.getRasa()); + System.out.println("yang berwarna " + drnk.getColour()); + System.out.println("dengan harga " + drnk.getHarga()); + } +} + + diff --git a/src/H071221099/Pertemuan_2/No2.java b/src/H071221099/Pertemuan_2/No2.java new file mode 100644 index 0000000..d7241fa --- /dev/null +++ b/src/H071221099/Pertemuan_2/No2.java @@ -0,0 +1,44 @@ +class No2Person { + String name; + int age; + boolean isMale; + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setAge(int age) { + this.age = age; + } + //penggunaan this ialah untuk merujuk pada objek saat ini dari kelas yang sama. + public int getAge() { + return age; + } + + public void setGender(boolean isMale) { + this.isMale = isMale; + } + + public String getGender() { + return isMale ? "Pria" : "Wanita"; + } +} + +public class No2{ + + public static void main(String[] args) { + No2Person people = new No2Person(); + people.setName("thancos"); + people.setAge(19); + people.setGender(true); + + System.out.println("Name: " + people.getName()); + System.out.println("Umur: " + people.getAge()); + System.out.println("Jenis Kelamin: " + people.getGender()); + + } +} diff --git a/src/H071221099/Pertemuan_2/No3.java b/src/H071221099/Pertemuan_2/No3.java new file mode 100644 index 0000000..8c3ffbe --- /dev/null +++ b/src/H071221099/Pertemuan_2/No3.java @@ -0,0 +1,59 @@ +class Produk{ + int id; + String nama; + int stok; + int harga; + + public void isAvailable(){ + if (stok > 0) { + System.out.println("Tersedia"); + + } else { + System.out.println("Tidak tersedia"); + } + } + public void display() { + System.out.println("Nama : " + nama); + System.out.println(id); + System.out.println(stok); + System.out.println(harga); + + } + + public int getId(){ + return id; + } + public String getNama(){ + return nama; + } + public int getStok(){ + return stok; + } + public int getHarga(){ + return harga; + } + } + + public class No3{ + public static void main(String[] args) { + Produk proone = new Produk(); + Produk protwo = new Produk(); + + proone.id = 12097; + proone.nama = "Baju kaos"; + proone.stok = 0; + proone.harga = 50000; + + protwo.id = 10927; + protwo.nama = "Celana pendek"; + protwo.stok = 0; + protwo.harga = 35000; + + + proone.isAvailable(); //untuk pemanggilan + proone.display(); + protwo.isAvailable(); + protwo.display(); + + } + } \ No newline at end of file diff --git a/src/H071221099/Pertemuan_2/No4.java b/src/H071221099/Pertemuan_2/No4.java new file mode 100644 index 0000000..b95232a --- /dev/null +++ b/src/H071221099/Pertemuan_2/No4.java @@ -0,0 +1,25 @@ +class Cuboid { + double height; + double width; + double length; + + double getVolume() { + return height * width * length; // return volume dengan menggunakan rumus dibawah yg berguna mengembalikan nilai + } +} + + +public class No4 { + + public static void main(String[] args) { + Cuboid cuboidone = new Cuboid(); + + cuboidone.height = 15; + cuboidone.width = 20; //mengisi value dari ketiga atribut + cuboidone.length = 15; + + double volume = cuboidone.getVolume(); + + System.out.printf("Volume = %.2f", volume); + } +} diff --git a/src/H071221099/Pertemuan_2/No5.java b/src/H071221099/Pertemuan_2/No5.java new file mode 100644 index 0000000..e41da19 --- /dev/null +++ b/src/H071221099/Pertemuan_2/No5.java @@ -0,0 +1,44 @@ +class Mahasiswa { + String nama; + String nim; + Alamat alamat; + + public String getNama() { + return nama; + } + + public String getNim() { + return nim; + } + + public Alamat getAlamat() { + return alamat; + } +} + +class Alamat { + String jalan; + String kota; + + + public String getAlamatLengkap() { + return jalan + ", " + kota; + } +} + +public class No5 { + public static void main(String[] args) { + Alamat alamat = new Alamat(); + alamat.jalan = "Sudiang Planet"; + alamat.kota = "Makassar City"; + + Mahasiswa mahasiswa = new Mahasiswa(); + mahasiswa.alamat = alamat; + mahasiswa.nama = "Muhammad Fathan Tsaqib"; + mahasiswa.nim = "H071221099"; + + System.out.println("Nama : " + mahasiswa.getNama()); + System.out.println("Nim : " + mahasiswa.getNim()); + System.out.println("Alamat : " + mahasiswa.getAlamat().getAlamatLengkap()); + } +} diff --git a/src/H071221099/Pertemuan_3/Laptop.java b/src/H071221099/Pertemuan_3/Laptop.java new file mode 100644 index 0000000..88d6525 --- /dev/null +++ b/src/H071221099/Pertemuan_3/Laptop.java @@ -0,0 +1,37 @@ +public class Laptop { + String merek; + String os; + int ram; + String processor; + int slotRamKosong; + + public Laptop(String merek, String os, int ram, String processor, int slotRamKosong) { + this.merek = merek; + this.os = os; + this.ram = ram; + this.processor = processor; + this.slotRamKosong = slotRamKosong; + } + + public void upgradeRam(int ukuran) { + if (slotRamKosong > 0) { + ram += ukuran; + slotRamKosong--; + System.out.println("RAM berhasil diupgrade menjadi " + ram + " GB"); + } else { + System.out.println("Tidak ada slot kosong untuk menambah RAM"); + } + } + + public static void main(String[] args) { + Laptop laptop = new Laptop("Asus", "Windows 10", 8, "Intel Core i5",1); + System.out.println("Merek: " + laptop.merek); + System.out.println("OS: " + laptop.os); + System.out.println("RAM: " + laptop.ram + " GB"); + System.out.println("Processor: " + laptop.processor); + System.out.println("Slot kosong: " + laptop.slotRamKosong); + laptop.upgradeRam(4); + System.out.println("Slot kosong setelah upgrade: " + laptop.slotRamKosong); + } +} + diff --git a/src/H071221099/Pertemuan_3/No1.java b/src/H071221099/Pertemuan_3/No1.java new file mode 100644 index 0000000..a2c3ca3 --- /dev/null +++ b/src/H071221099/Pertemuan_3/No1.java @@ -0,0 +1,74 @@ +class ApexLegends { + String character; + int armor; + Skill skill; + String role; + + // public void karakter() { + // System.out.println("this character" + character); + // } + + public Skill getSkill(){ + return skill; + } + + public void setSkill(Skill skill){ + this.skill = skill; + } + + public String getRole() { + return role; + } + + public void setRole(String role){ + this.role = role; + } + + public int getArmor(){ + return armor; + } + + public void setArmor(int armor){ + this.armor = armor; + } + + public ApexLegends(String character, String role, int armor){ + this.character = character; + this.role = role; + this.armor = armor; + System.out.println(); + } + + public ApexLegends( String character){ + this.character = character; + System.out.println(); + } +} + +class Skill { + String powerone; + String powertwo; + + public String getfullSkill(){ + return powerone + powertwo; + } +} + +public class No1{ + public static void main(String[] args) { + Skill skill = new Skill(); + skill.powerone = "duarr "; + skill.powertwo = "afh iyhh"; + + ApexLegends apex = new ApexLegends("layla"); + apex.skill = skill; + apex.armor = 2000; + apex.role = "Rush"; + + + System.out.println("Nama karakter : " + apex.character); + System.out.println("Jumlah armor: " + apex.armor); + System.out.println("Roll : " + apex.getRole()); + System.out.println("Skill : " +apex.getSkill().getfullSkill()); + } +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_3/No2.java b/src/H071221099/Pertemuan_3/No2.java new file mode 100644 index 0000000..c0a3dc4 --- /dev/null +++ b/src/H071221099/Pertemuan_3/No2.java @@ -0,0 +1,53 @@ +class Player { + private String name; + private int hp ; + private int attackPower; + private int defense; + + public Player() { + } + + public void getDamage(Player enemy) { + hp = hp - Math.abs(enemy.getAttackPower() - defense); + } + + // Lengkapi + public Player (String name,int defense){ + this.name = name; + this.hp = 100; + this.defense = defense; + } + + public Player (String name,int attackPower,int defense){ + this(name, defense); + this.attackPower = attackPower; + + } + + + public void setAttackPower(int attackPower){ + this.attackPower = attackPower; + } + public void status() { + System.out.println(name + " status"); + System.out.println("HP = " + hp); + System.out.println("Defense = " + defense); + System.out.println("Attack = " + attackPower + "\n"); + } + + int getAttackPower() { + return attackPower; + } +} + +public class No2 { + public static void main(String[] args) { + Player player1 = new Player("Mino", 30, 15); + Player player2 = new Player("Hilda", 10); + player2.setAttackPower(35); + + player1.getDamage(player2); + player1.status(); + player2.status(); + } +} diff --git a/src/H071221099/Pertemuan_3/laptopbaru.java b/src/H071221099/Pertemuan_3/laptopbaru.java new file mode 100644 index 0000000..1d9e0b1 --- /dev/null +++ b/src/H071221099/Pertemuan_3/laptopbaru.java @@ -0,0 +1,37 @@ +public class laptopbaru { + String merek; + String os; + int ram; + String processor; + int slotRamKosong; + + public laptopbaru(String merek, String os, int ram, String processor, int slotRamKosong) { + this.merek = merek; + this.os = os; + this.ram = ram; + this.processor = processor; + this.slotRamKosong = slotRamKosong; + } + + public void upgradeRam(int ukuran) { + if (slotRamKosong > 0) { + ram += ukuran; + slotRamKosong--; + System.out.println("RAM berhasil diupgrade menjadi " + ram + " GB"); + } else { + System.out.println("Tidak ada slot kosong untuk menambah RAM"); + } + } + + public static void main(String[] args) { + laptopbaru laptop = new laptopbaru("Asus", "Windows 10", 8, "Intel Core i5",1); + System.out.println("Merek: " + laptop.merek); + System.out.println("OS: " + laptop.os); + System.out.println("RAM: " + laptop.ram + " GB"); + System.out.println("Processor: " + laptop.processor); + System.out.println("Slot kosong: " + laptop.slotRamKosong); + laptop.upgradeRam(4); + System.out.println("Slot kosong setelah upgrade: " + laptop.slotRamKosong); + } +} + diff --git a/src/H071221099/Pertemuan_4/Book.java b/src/H071221099/Pertemuan_4/Book.java new file mode 100644 index 0000000..eccc15e --- /dev/null +++ b/src/H071221099/Pertemuan_4/Book.java @@ -0,0 +1,73 @@ +public class Book { + String tittle; + String author; + String type; + int yearPublished; + int price; + // public Object setTittle; + // public Object setPrice; + // public Object setYearPublished; + // public Object setType; + public Book(){} + + public void setTittle(String tittle) { + this.tittle = tittle; + } + public void setAuthor(String author) { + this.author = author; + } + public void setType(String type) { + this.type = type; + } + public void setYearPublished(int yearPublished) { + this.yearPublished = yearPublished; + } + public void setPrice(int price) { + this.price = price; + } + + public Book(String tittle, String author, String type, int yearPublished, int price) { + this.tittle = tittle; + this.author = author; + this.type = type; + this.yearPublished = yearPublished; + this.price = price; + } + public void displayInfo(){ + System.out.println(tittle); + System.out.println(author); + System.out.println(type); + System.out.println(yearPublished); + System.out.println(price); + } + + public void setAuthor() { + } + + public void setTittle() { + } + + public void setType() { + } + + public String getTittle() { + return tittle; + } + + public String getAuthor() { + return author; + } + + public String getType() { + return type; + } + + public int getYearPublished() { + return yearPublished; + } + + public int getPrice() { + return price; + } + +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_4/Main.java b/src/H071221099/Pertemuan_4/Main.java new file mode 100644 index 0000000..a33c50f --- /dev/null +++ b/src/H071221099/Pertemuan_4/Main.java @@ -0,0 +1,175 @@ +import java.util.ArrayList; +import java.util.Scanner; + +public class Main { + private static ArrayList listUser = new ArrayList<>(); + private static ArrayList listUserProfile = new ArrayList<>(); + private static Scanner sc = new Scanner(System.in); + + public static void main(String[] args) { + // Memanggil method runApp(); + runApp(); + } + + private static void runApp() { + // Menu Utama Aplikasi + System.out.println("-------------------------"); + System.out.println("Aplikasi Login Sederhana"); + System.out.println("-------------------------"); + System.out.println("1. Login"); + System.out.println("2. Register"); + System.out.print("> "); + + // Menginput pilihan menu + int selectMenu = sc.nextInt(); + sc.nextLine(); + switch (selectMenu) { + case 1: + // Membuka Halaman Login + showLoginMenu(); + break; + case 2: + // Membuka Halaman Register + showRegisterMenu(); + default: + // Mengulang Pemanggilan Menu Utama + runApp(); + } + } + + private static void showLoginMenu() { + // Halaman Login + System.out.println("-------------------------"); + System.out.println("Login"); + // Menginput Username dan Menyimpannya di attribute username; + System.out.println("Masukkan Username"); + System.out.print("> "); + + String username = sc.next(); + // Membuat variabel userIndex yang mana nanti akan menampung index dari user + int userIndex = -1; + for (int i = 0; i < listUser.size(); i++) { + /* + * TODO + * Buatlah sebuah perkondisian (IF) yang akan + * Mengecek apakah user index ke i dari listUser memiliki username yang sama + * dengan username yang + * diinput. + * Jika ada ganti userIndex dengan Index dari User Tersebut, kemudian hentikan + * perulangan + */ + if (listUser.get(i).getUsername().equals(username)){ //untuk membandingkan nilai us tersebut dengan nilain us yg diberikan + userIndex = i; + break; + } + + } + // Saat userIndex tidak sama dengan -1 atau userIndexnya ditemukan + if (userIndex != -1) { + // Menginput Password + System.out.println("Password"); + System.out.print("> "); + String password = sc.next(); + + /* + * TODO + * Mengecek apakah password dari User yang login berdasarkan username + * sama dengan password yang diinput sebelumnya, kemudian simpan + * hasilnya di variabel isPasswordMatch + */ + + // Jika passwordnya sama maka berhasil login + boolean isPasswordMatch = listUser.get(userIndex).getPassword().equals(password); + if (isPasswordMatch) { + System.out.println("Berhasil Login"); + /* + * TODO + * panggil method showDetailUser dan kirimkan data Profile User yang login + * + */ + showDetailUser(listUserProfile.get(userIndex)); + System.exit(0); + } else { + // saat password salah akan menampikan password salah + System.out.println("Password Salah"); + } + } + } + + private static void showRegisterMenu() { + System.out.println("-------------------------"); + System.out.println("REGISTER"); + + // Menginput username dan password + System.out.println("Username"); + System.out.print("> "); + String username = sc.nextLine(); + System.out.println("Password"); + System.out.print("> "); + String password = sc.nextLine(); + /* + * TODO + * Buatlah atau Instance objek User baru, dan tambahkan + * username dan password yang diinput sebelumnya secara langsung + * saat instance User + */ + User user = new User(username, password); + /* + * TODO + * Buatlah atau Instance objek Profile baru + */ + Profile profile = new Profile(); + + // Menginput Data Profile + System.out.println("Nama Lengkap"); + System.out.print("> "); + String fullName = sc.nextLine(); + System.out.println("Umur"); + System.out.print("> "); + int age = sc.nextInt(); + sc.nextLine(); + System.out.println("Hobby"); + System.out.print("> "); + String hobby = sc.nextLine(); + + /* + * TODO + * Berikan nilai fullName, age, dan hobby ke objek profile yang telah + * di Instance sebelumnya. Nilai ini diperoleh dari data profile yang + * diinput sebelumnya + */ + profile.setFullName(fullName); + profile.setNickName(StringUtils.generateNickname(fullName)); + profile.setAge(age); + profile.setHobby(hobby); + /* + * TODO + * Berikan nilai nickName ke objek profile, + * Nilai ini diperoleh menggunakan static method yang dibuat di class + * StringUtils, dengan mengirimkan fullName yang diinput sebelumnya + */ + + // Menambahkan user yang dibuat ke list user + listUser.add(user); + // Menambahkan profile user yang dibuat ke list profile + listUserProfile.add(profile); + System.out.println("-------------------------"); + System.out.println("Berhasil Membuat User Baru!!"); + runApp(); + } + + private static void showDetailUser(Profile profile) { + /* + * TODO * + * Tampilkan semua data profile user yang login + */ + System.out.println("-------------------------"); + System.out.println("PULANGMKI"); + System.out.println("-------------------------"); + System.out.println("Nama Lengkap: " + profile.getFullName()); + System.out.println("Nama Panggilan: " + profile.getNickName()); + System.out.println("Umur" + profile.getAge()); + System.out.println("Hobby: " + profile.GetHobby()); + } + +} diff --git a/src/H071221099/Pertemuan_4/Main2.java b/src/H071221099/Pertemuan_4/Main2.java new file mode 100644 index 0000000..12a44d7 --- /dev/null +++ b/src/H071221099/Pertemuan_4/Main2.java @@ -0,0 +1,22 @@ +public class Main2 { + + public static void main(String[] args) { + Book book = new Book(); + book.setTittle("Palangga"); + book.setAuthor("Rafylo"); + book.setType("Komedi"); + book.setYearPublished(2020); + book.setPrice(1000000); + book.displayInfo(); + System.out.println("============="); + Book book2 = new Book ( "AB", "Rukont", "Romance",2022, 10000); + System.out.println(book2.getTittle()); + System.out.println(book2.getAuthor()); + System.out.println(book2.getType()); + System.out.println(book2.getYearPublished()); + System.out.println(book2.getPrice()); + SelfUtils.displaySelfData(); + } +} + + diff --git a/src/H071221099/Pertemuan_4/Profile.java b/src/H071221099/Pertemuan_4/Profile.java new file mode 100644 index 0000000..641814a --- /dev/null +++ b/src/H071221099/Pertemuan_4/Profile.java @@ -0,0 +1,42 @@ +public class Profile { + private String fullName; + private int age; + private String hobby; + private String nickName; + + public Profile(String fullName, int age, String hobby, String nickName) { + this.fullName = fullName; + this.age = age; + this.hobby = hobby; + this.nickName = nickName; + } + public Profile() {} + + public String getFullName() { + return fullName; + } + public void setFullName(String fullName) { + this.fullName = fullName; + } + public int getAge() { + return age; + } + public void setAge(int age) { + this.age = age; + } + public String GetHobby(){ + return hobby; + } + public void setHobby(String hobby){ + this.hobby = hobby; + } + + public String getNickName(){ + return nickName; + } + + public void setNickName (String nickName){ + this.nickName = nickName; + } + +} diff --git a/src/H071221099/Pertemuan_4/SelfUtils.java b/src/H071221099/Pertemuan_4/SelfUtils.java new file mode 100644 index 0000000..0749ea1 --- /dev/null +++ b/src/H071221099/Pertemuan_4/SelfUtils.java @@ -0,0 +1,6 @@ +public class SelfUtils { + public static void displaySelfData() { + System.out.println("Muhammad Fathan Tsaqib"); + System.out.println("H071221099"); + } +} diff --git a/src/H071221099/Pertemuan_4/StringUtils.java b/src/H071221099/Pertemuan_4/StringUtils.java new file mode 100644 index 0000000..6222630 --- /dev/null +++ b/src/H071221099/Pertemuan_4/StringUtils.java @@ -0,0 +1,24 @@ +public class StringUtils { + public static String generateNickname(String fullName){ //generateNickname digunakan untuk mengambil nama panggilan dari sebuah nama lengkap + String[] nameParts = fullName.split(" "); //memecah fullname menjadi beberapa bagian menggunakan split dan memasukkannya ke dalam array nameparts + + if (nameParts.length ==1) { //memeriksa apakah hanya memiliki satu elemen + return fullName; //jika iya maka fullName tersebut sudah merupakan sebuah nickname sehingga method akan mengembalikan fullName + }else{ + return nameParts[1]; //jika tidak, maka method akan mengambil elemen kedua dari nameParts (indeks 1) yang seharusnya merupakan nama belakang, lalu mengembalikannya sebagai nickname. + } + } + + /* + TODO + * Buatlah sebuah method static yang akan + * mengembalikan nickName berdasarkan fullName yang diberikan + * aturan pembuatan nickName adalah : + * 1. Jika fullName hanya 1 kata maka nickName = fullName + * (ex: FullName = Agus, maka NickName = Agus) + * 2. Jika fullName lebih dari 1 kata maka nickName adalah kata kedua dari + * fullName + * (ex: FullName = Eurico Devon, maka NickName = Devon) + */ +} + diff --git a/src/H071221099/Pertemuan_4/User.java b/src/H071221099/Pertemuan_4/User.java new file mode 100644 index 0000000..9d0b3ba --- /dev/null +++ b/src/H071221099/Pertemuan_4/User.java @@ -0,0 +1,27 @@ +public class User { + private String username; + private String password; + /* + * TODO: + * Tambahkan attribute, method, atau constructor + * yang dibutuhkan di kelas user + */ + + public User(String username, String password){ + this.username = username; + this.password = password; + } + + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } +} diff --git a/src/H071221099/Pertemuan_5/BangunDatar.java b/src/H071221099/Pertemuan_5/BangunDatar.java new file mode 100644 index 0000000..97203b2 --- /dev/null +++ b/src/H071221099/Pertemuan_5/BangunDatar.java @@ -0,0 +1,95 @@ +public class BangunDatar { + double keliling, luas; + + public double getKeliling() { + return keliling; + } + + public double getLuas() { + return luas; + } + + double ni1, ni2, ni3, ni4; + + public BangunDatar(double ni1, double ni2, double ni3, double ni4) { + this.ni1 = ni1; + this.ni2 = ni2; + this.ni3 = ni3; + this.ni4 = ni4; + } + + public BangunDatar(double ni1, double ni2, double ni3) { + this.ni1 = ni1; + this.ni2 = ni2; + this.ni3 = ni3; + } + + public BangunDatar(double ni1, double ni2) { + this.ni1 = ni1; + this.ni2 = ni2; + } + + public BangunDatar(double ni1) { + this.ni1 = ni1; + } + } + + class Persegi extends BangunDatar { + public Persegi (double ni1){ + super(ni1); + } + public double getKeliling(){ + return ni1+ni1+ni1+ni1; + } + public double getLuas(){ + return ni1*ni1; + } + } + + class PersegiPanjang extends BangunDatar { + public PersegiPanjang (double ni1, double ni2){ + super(ni1, ni2); + } + public double getKeliling(){ + return 2*(ni1+ni2); + } + public double getLuas(){ + return ni1*ni2; + } + } + + class Lingkaran extends BangunDatar { + public Lingkaran (double ni1){ + super(ni1); + } + public double getKeliling(){ + return 2*Math.PI*ni1; + } + public double getLuas(){ + return Math.PI*ni1*ni1; + } + } + + class Segitiga extends BangunDatar { + public Segitiga (double ni1,double ni2, double ni3){ + super(ni2, ni3); + } + public double getKeliling(){ + return ni1+ni1+ni1; + } + public double getLuas(){ + return 0.5 *ni2*ni3; + } + } + + class Trapesium extends BangunDatar { + public Trapesium (double ni1, double ni2){ + super(ni1, ni2); + } + public double getKeliling(){ + return ni1+ni1+ni1+ni1; + } + public double getLuas(){ + return 0.5*(ni1+ni1)*ni2; + } + } \ No newline at end of file diff --git a/src/H071221099/Pertemuan_5/BangunRuang.java b/src/H071221099/Pertemuan_5/BangunRuang.java new file mode 100644 index 0000000..a755bfb --- /dev/null +++ b/src/H071221099/Pertemuan_5/BangunRuang.java @@ -0,0 +1,84 @@ +class BangunRuang { + double volume, luaspermukaan; + + public double getLuaspermukaan() { + return luaspermukaan; + } + + public double getVolume() { + return volume; + } + + double n1, n2, n3, n4; + + public BangunRuang(double n1, double n2, double n3, double n4) { + this.n1 = n1; + this.n2 = n2; + this.n3 = n3; + this.n4 = n4; + } + + public BangunRuang(double n1, double n2, double n3) { + this.n1 = n1; + this.n2 = n2; + this.n3 = n3; + } + + public BangunRuang(double n1, double n2) { + this.n1 = n1; + this.n2 = n2; + } + + public BangunRuang(double n1) { + this.n1 = n1; + } +} + +class Kubus extends BangunRuang { + public Kubus (double sisi){ + super(sisi); + } + public double getVolume(){ + return n1*n1*n1; + } + public double getLuaspermukaan(){ + return 6*n1*n1; + } +} + +class Balok extends BangunRuang{ + public Balok (double n2, double n3, double n4){ + super(n2, n3, n4); + } + public double getVolume(){ + return n2*n3*n4; + } + public double getLuaspermukaan(){ + return 2*n2*n3+ n2*n4+n3*n4; + } + +} + +class Bola extends BangunRuang{ + public Bola ( double n2){ + super(n2); + } + public double getVolume(){ + return 4/3 *Math.PI*n2*n2*n2; + } + public double getLuaspermukaan(){ + return 4*Math.PI*n2*n2; + } +} + +class Tabung extends BangunRuang{ + public Tabung (double n3,double n4){ + super(n3, n4); + } + public double getLuaspermukaan(){ + return 2*Math.PI*n3*(n3+n4); + } + public double getVolume(){ + return Math.PI*n3*n3*n4; + } +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_5/Main.java b/src/H071221099/Pertemuan_5/Main.java new file mode 100644 index 0000000..ca12800 --- /dev/null +++ b/src/H071221099/Pertemuan_5/Main.java @@ -0,0 +1,12 @@ +public class Main { + public static void main(String[] args) { + Persegi persegi = new Persegi(10); + System.out.println(persegi.getKeliling()); + System.out.println(persegi.getLuas()); + + + Tabung tabung = new Tabung(10, 15); + System.out.println(tabung.getLuaspermukaan()); + System.out.println(tabung.getVolume()); + } +} diff --git a/src/H071221099/Pertemuan_5/No2.java b/src/H071221099/Pertemuan_5/No2.java new file mode 100644 index 0000000..68583ae --- /dev/null +++ b/src/H071221099/Pertemuan_5/No2.java @@ -0,0 +1,83 @@ +class Anggota { + String nama; + int umur; + String alamat; + + public String getNama() { + return nama; + } + + public void setNama(String nama) { + this.nama = nama; + } + + public int getUmur() { + return umur; + } + + public void setUmur(int umur) { + this.umur = umur; + } + + public String getAlamat() { + return alamat; + } + + public void setAlamat(String alamat) { + this.alamat = alamat; + } + + public Anggota(String nama, int umur, String alamat) { + this.nama = nama; + this.umur = umur; + this.alamat = alamat; + } +} + +class PengurusInti extends Anggota { + String nama; + String jabatan; + + public String getJabatan() { + return jabatan; + } + + public void setJabatan(String jabatan) { + this.jabatan = jabatan; + } + + public PengurusInti(String nama, int umur, String alamat, String jabatan) { + super (nama, umur, alamat); + this.jabatan = jabatan; + } + + void showDetail(){ + System.out.println(jabatan); + System.out.println(super.nama); + } +} + +class koordinatorBidang extends Anggota { + String bidang; + + public koordinatorBidang(String nama, int umur, String alamat, String bidang) { + super(nama, umur, alamat); + this.bidang = bidang; + } +} + +class Staf extends Anggota { + String divisi; + + public Staf(String nama, int umur, String alamat, String divisi) { + super(nama, umur, alamat); + this.divisi = divisi; + } +} + +public class No2{ + public static void main(String[] args) { + PengurusInti pinti = new PengurusInti("fylo", 25, "goa ria", "goa ria"); + pinti.showDetail(); + } +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_5/Screenshot 2023-04-17 141700.png b/src/H071221099/Pertemuan_5/Screenshot 2023-04-17 141700.png new file mode 100644 index 0000000..afcbe87 Binary files /dev/null and b/src/H071221099/Pertemuan_5/Screenshot 2023-04-17 141700.png differ diff --git a/src/H071221099/Pertemuan_5/diagram (1).drawio.png b/src/H071221099/Pertemuan_5/diagram (1).drawio.png new file mode 100644 index 0000000..d4917c5 Binary files /dev/null and b/src/H071221099/Pertemuan_5/diagram (1).drawio.png differ diff --git a/src/H071221099/Pertemuan_6/Device.drawio.png b/src/H071221099/Pertemuan_6/Device.drawio.png new file mode 100644 index 0000000..e2e2829 Binary files /dev/null and b/src/H071221099/Pertemuan_6/Device.drawio.png differ diff --git a/src/H071221099/Pertemuan_6/Dog.drawio.png b/src/H071221099/Pertemuan_6/Dog.drawio.png new file mode 100644 index 0000000..03565d3 Binary files /dev/null and b/src/H071221099/Pertemuan_6/Dog.drawio.png differ diff --git a/src/H071221099/Pertemuan_6/Dog.java b/src/H071221099/Pertemuan_6/Dog.java new file mode 100644 index 0000000..f75759f --- /dev/null +++ b/src/H071221099/Pertemuan_6/Dog.java @@ -0,0 +1,104 @@ +abstract class Dog implements Movaeble{ + protected int position; + protected int averageLength; + + abstract void describe(); + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public int getAverageLength() { + return averageLength; + } + + public void setAverageLength(int averageLength) { + this.averageLength = averageLength; + } + + public Dog(int position, int averageLength) { + this.position = position; + this.averageLength = averageLength; + } + +} + +class Pitbull extends Dog{ + + public Pitbull(int position, int averageLength) { + super(position, averageLength); + } + + @Override + public void move() { + setPosition(getPosition()+3); + System.out.println("Bergerak 3 kali ke kanan, posisi sekarang di" + getPosition()+ "langkah di kanan"); + } + + @Override + void describe() { + System.out.println("Panjang rata-rata Pitbull adalah" + getAverageLength() + "cm"); + } + +} + +class SiberianHusky extends Dog { + + public SiberianHusky(int position, int averageLength) { + super(position, averageLength); + } + + @Override + public void move() { + setPosition(getPosition()+2); + System.out.println("Bergerak 2 kali ke kanan, posisi sekarang di" + getPosition()+ "langkah di kanan"); + } + + @Override + void describe() { + System.out.println("Panjang rata-rata Siberian Husky adalah" + getAverageLength() + "cm"); + } + +} + +class Bulldog extends Dog { + public Bulldog(int position, int averageLength) { + super(position, averageLength); + + } + + @Override + public void move() { + setPosition(getPosition()+1); + System.out.println("Bergerak 1 kali ke kanan, posisi sekarang di " + getPosition()+ " langkah di kanan"); + } + + @Override + void describe() { + System.out.println("Panjang rata-rata Bulldog adalah " + getAverageLength() + " cm"); + } + +} + +class GermanShepherd extends Dog { + + public GermanShepherd(int position, int averageLength) { + super(position, averageLength); + } + + @Override + public void move() { + setPosition(getPosition()+3); + System.out.println("Bergerak 3 kali ke kanan, posisi sekarang di" + getPosition()+ "langkah di kanan"); + } + + @Override + void describe() { + System.out.println("Panjang rata-rata German Shepherd adalah" + getAverageLength() + "cm"); + } + +} diff --git a/src/H071221099/Pertemuan_6/Main.java b/src/H071221099/Pertemuan_6/Main.java new file mode 100644 index 0000000..c0261f5 --- /dev/null +++ b/src/H071221099/Pertemuan_6/Main.java @@ -0,0 +1,13 @@ +public class Main { + public static void main(String[] args) { + Smartphone smartphone = new Smartphone(10000000, "ROG"); + smartphone.move(); + + Car car = new Car(10, "Black", 1000); + car.move(); + + Bulldog bulldog = new Bulldog(1, 50); + bulldog.describe(); + bulldog.move(); + } +} diff --git a/src/H071221099/Pertemuan_6/Movaeble.java b/src/H071221099/Pertemuan_6/Movaeble.java new file mode 100644 index 0000000..7acd511 --- /dev/null +++ b/src/H071221099/Pertemuan_6/Movaeble.java @@ -0,0 +1,40 @@ +interface Movaeble { + void move (); +} + +class Smartphone implements Movaeble { + protected int price; + protected String brand; + + public Smartphone(int price, String brand) { + this.price = price; + this.brand = brand; + } + + @Override + public void move() { + System.out.println("Smartphone berpindah"); + } + + +} + +class Car implements Movaeble { + protected int totalForwardGear; + protected String color; + protected int maxSpeed; + + + public Car(int totalForwardGear, String color, int maxSpeed) { + this.totalForwardGear = totalForwardGear; + this.color = color; + this.maxSpeed = maxSpeed; + } + + + @Override + public void move() { + System.out.println("Mobil sedang berakselerasi"); + } + +} diff --git a/src/H071221099/Pertemuan_7/No1.java b/src/H071221099/Pertemuan_7/No1.java new file mode 100644 index 0000000..822c38c --- /dev/null +++ b/src/H071221099/Pertemuan_7/No1.java @@ -0,0 +1,104 @@ +abstract class Character { + protected String name ; + protected int attackPower; + + public String getName() { + return name; + } + + public int getAttackPower() { + return attackPower; + } + + public Character(String name, int attackPower) { + this.name = name; + this.attackPower = attackPower; + } + + abstract int attack(); // bertujuan untuk mengatur serangan karakter + + abstract int attack(String attackType); // bertujuan untuk mengatur serangan karakter dengan jenis serangan tertentu, yang ditentukan oleh parameter attackType. +} + +class Fighter extends Character { + + public Fighter(String name, int attackPower) { + super(name, attackPower); + } + + @Override + int attack() { + return attackPower; + } + + @Override + int attack(String attackType) { + int AP = attackPower; + if (attackType.equals("melee")) { + AP = attackPower * 2; + } else if (attackType.equals("ranged")) { + AP = attackPower; + } + return AP; + } + +} + +class Mage extends Character { + + public Mage(String name, int attackPower) { + super(name, attackPower); + } + + @Override + int attack() { + return attackPower; + } + + @Override + int attack(String attackType) { + int kekuatanSerangan = attackPower; + if (attackType.equals("fire")) { + kekuatanSerangan = attackPower * 3 ; + } else if (attackType.equals("frost")) { + kekuatanSerangan = attackPower* 2 ; + } + return kekuatanSerangan; + } + +} + +public class No1 { + public static void printAttack(Character character) { + System.out.println("Nama : " + character.getName()); + System.out.println("ATTAC INFORMATION"); + System.out.println("Attack Power : " + character.attackPower); + if (character instanceof Fighter) { + System.out.println("Melee : " + character.attack("Melee")); + System.out.println("Ranged : " + character.attack("Ranged")); + } else if (character instanceof Mage) { + System.out.println("Fire : " + character.attack("Fire")); + System.out.println("Frost : " + character.attack("Frost")); + } + } + public static void main(String[] args) { + Fighter fighter = new Fighter("Ocang", 10); + Mage mage = new Mage("Fikry", 100); + Fighter faikter = new Fighter("Mayko", 1000); + Fighter petarung = new Fighter("Fylo", 10000); + Mage magee = new Mage("Delfa", 100000); + + Character[] hero = new Character[5]; + hero[0] = fighter; + hero[1] = mage; + hero[2] = faikter; + hero[3] = petarung; + hero[4] = magee; + + + for (Character i : hero) { // membuat perulangan untuk mengeluarkan objek2 yang ada pada list hero. objek2 tsb mau d print informasi ttg attack powernya, jdi dipanggil method print attack. + printAttack(i);// main, karena method static itu menempel pada kelasnya. + System.out.println(""); + } + } +} diff --git a/src/H071221099/Pertemuan_7/No2.java b/src/H071221099/Pertemuan_7/No2.java new file mode 100644 index 0000000..cc61f12 --- /dev/null +++ b/src/H071221099/Pertemuan_7/No2.java @@ -0,0 +1,40 @@ +class Product { + protected String nama; + protected T harga; + protected String expire; + public String getNama() { + return nama; + } + public void setNama(String nama) { + this.nama = nama; + } + public T getHarga() { + return harga; + } + public void setHarga(T harga) { + this.harga = harga; + } + public String getExpire() { + return expire; + } + public void setExpire(String expire) { + this.expire = expire; + } + public Product(String nama, T harga, String expire) { + this.nama = nama; + this.harga = harga; + this.expire = expire; + } +} + +public class No2 { + public static void main(String[] args) { + Product product = new Product<>("Kinderjoy", 10000, "2023-05-01"); + Product productLagi = new Product<>("Sari Roti", "Rp 15.00", "2023-05-20"); + Product productLagiLagi = new Product<>("Susu Kurma", 7.5, "2023-06-01"); + + System.out.println(product.getNama() + " - " + product.getHarga() + " - " + product.getExpire()); + System.out.println(productLagi.getNama() + " - " + productLagi.getHarga() + " - " + productLagi.getExpire()); + System.out.println(productLagiLagi.getNama() + " - " + productLagiLagi.getHarga() + " - " + productLagiLagi.getExpire()); + } +} diff --git a/src/H071221099/Pertemuan_7/No3/Burger.java b/src/H071221099/Pertemuan_7/No3/Burger.java new file mode 100644 index 0000000..c3dbeba --- /dev/null +++ b/src/H071221099/Pertemuan_7/No3/Burger.java @@ -0,0 +1,12 @@ +package No3; + +public class Burger implements Food{ + protected int harga; + + @Override + public int getPrice() { + return 1000000; + } + + +} diff --git a/src/H071221099/Pertemuan_7/No3/Food.java b/src/H071221099/Pertemuan_7/No3/Food.java new file mode 100644 index 0000000..bc20937 --- /dev/null +++ b/src/H071221099/Pertemuan_7/No3/Food.java @@ -0,0 +1,5 @@ +package No3; + +interface Food { + int getPrice(); +} diff --git a/src/H071221099/Pertemuan_7/No3/FoodFactory.java b/src/H071221099/Pertemuan_7/No3/FoodFactory.java new file mode 100644 index 0000000..9366301 --- /dev/null +++ b/src/H071221099/Pertemuan_7/No3/FoodFactory.java @@ -0,0 +1,15 @@ +package No3; + +public class FoodFactory { + static Food getFood(String food) { // bertipe data "Food" karena mengembalikan objek makanan yang sesuai jenisnya (sesuai perintah soal) + Food makanan = null; // nilai default + if (food.equals("burger")) { + makanan = new Burger(); + } else if (food.equals("pizza")) { + makanan = new Pizza(); + } else if (food.equals("steak")) { + makanan = new Steak(); + } + return makanan; + } +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_7/No3/Main.java b/src/H071221099/Pertemuan_7/No3/Main.java new file mode 100644 index 0000000..a3af62a --- /dev/null +++ b/src/H071221099/Pertemuan_7/No3/Main.java @@ -0,0 +1,21 @@ +package No3; + +import java.util.List; +import java.util.ArrayList; + +public class Main { + public static void main(String[] args) { + Food burger = FoodFactory.getFood("burger"); + Food pizza = FoodFactory.getFood("pizza"); + Food steak = FoodFactory.getFood("steak"); + + List foods = new ArrayList<>(); + foods.add(burger); + foods.add(pizza); + foods.add(steak); + + int total = Restaurant.calculateTotal(foods); + + System.out.println("Total price: " + total); + } +} diff --git a/src/H071221099/Pertemuan_7/No3/Pizza.java b/src/H071221099/Pertemuan_7/No3/Pizza.java new file mode 100644 index 0000000..ebce45c --- /dev/null +++ b/src/H071221099/Pertemuan_7/No3/Pizza.java @@ -0,0 +1,11 @@ +package No3; + +public class Pizza implements Food { + protected int harga; + + @Override + public int getPrice() { + return 12000000; + } + +} diff --git a/src/H071221099/Pertemuan_7/No3/Restaurant.java b/src/H071221099/Pertemuan_7/No3/Restaurant.java new file mode 100644 index 0000000..77d8e81 --- /dev/null +++ b/src/H071221099/Pertemuan_7/No3/Restaurant.java @@ -0,0 +1,12 @@ +package No3; +import java.util.List; + +public class Restaurant { + static int calculateTotal(List listMakanan) { + int totalPrice = 0; + for (Food i : listMakanan) { // perulangan untuk mengeluarkan objek-objeknya, i itu adalah objek-objek nya (burger,dll) + totalPrice += i.getPrice(); + } + return totalPrice; + } +} diff --git a/src/H071221099/Pertemuan_7/No3/Steak.java b/src/H071221099/Pertemuan_7/No3/Steak.java new file mode 100644 index 0000000..158fe4a --- /dev/null +++ b/src/H071221099/Pertemuan_7/No3/Steak.java @@ -0,0 +1,12 @@ +package No3; + +public class Steak implements Food{ + protected int harga; + + @Override + public int getPrice() { + return 18000000; + } + + +} diff --git a/src/H071221099/Pertemuan_8/AppRacer.java b/src/H071221099/Pertemuan_8/AppRacer.java new file mode 100644 index 0000000..5468cc1 --- /dev/null +++ b/src/H071221099/Pertemuan_8/AppRacer.java @@ -0,0 +1,197 @@ +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Random; + +public class AppRacer { + public static void main(String[] args) throws InterruptedException { + Tes typeRacer = new Tes(); + typeRacer.setNewWordsToType(); + System.out.println("|| Text to Type ||"); + System.out.println("\"" + typeRacer.getWordsToType() + "\""); + + Typer[] typers = new Typer[3]; + + typers[0] = new Typer("Bot Mansur", 40, typeRacer); + typers[1] = new Typer("Bot ToKu", 32, typeRacer); + typers[2] = new Typer("Bot Yukiao", 30, typeRacer); + + typeRacer.getRaceContestant().addAll(Arrays.asList(typers)); + + typeRacer.startRace(); + } +} + +class Typer extends Thread { + private String botName, wordsTyped; + private double wpm; + private Tes typeRacer; + + public Typer(String botName, double wpm, Tes typeRacer) { + this.botName = botName; + this.wpm = wpm; + this.wordsTyped = ""; + this.typeRacer = typeRacer; + } + + public void setBotName(String botName) { + this.botName = botName; + } + + public void setWpm(int wpm) { + this.wpm = wpm; + } + + public void addWordTyped(String newWordsTyped) { + this.wordsTyped += newWordsTyped + " "; + } + + public String getWordsTyped() { + return wordsTyped; + } + + public String getBotName() { + return botName; + } + + public double getWpm() { + return wpm; + } + + @Override + public void run() { + + String[] wordsToType = typeRacer.getWordsToType().split(" "); + + // TODO (1): Buatlah variable howLongToType yang memuat waktu yang diperlukan + // typer + // untuk menulis 1 kata dalam milisecond + int howLongToType = (int) Math.floor(((60 / this.wpm)) * 1000); + + // TODO (2): Buatlah perulangan untuk menambahkan kata dengan method + // addWordToTyped setelah interval waktu sebanyak howLongToType + for (int i = 0; i < wordsToType.length; i++) { + try { + Thread.sleep(howLongToType); + addWordTyped(wordsToType[i]); + } catch (InterruptedException e) { + System.out.println("Error: " + this.botName); + } + } + + this.addWordTyped("(selesai)"); + // TODO (3): menambahkan typer yang telah selesai mengetik semua kata ke list + // typeRaceTabel yang ada di class typeRacer + typeRacer.addResult(new Result(botName, howLongToType * wordsToType.length)); + } +} + +class Result { + private String name; + private int finishTime; + + public Result(String name, int finishTime) { + this.name = name; + this.finishTime = finishTime; + } + + public String getName() { + return name; + } + + public void setName(String racerName) { + this.name = racerName; + } + + public int getFinishTime() { + return finishTime; + } + + public void setFinishTime(int racerTime) { + this.finishTime = racerTime; + } +} + +class Tes { + private String wordsToType; + private ArrayList raceContestant = new ArrayList<>(); + private ArrayList raceStanding = new ArrayList<>(); + + public String getWordsToType() { + return wordsToType; + } + + public ArrayList getRaceContestant() { + return raceContestant; + } + + // Word by Yusuf Syam, Silahkan diubah jika dirasa kurang bijak + private String[] wordsToTypeList = { + "Menuju tak terbatas dan melampauinya", + "Kehidupan adalah perjalanan yang penuh dengan lika-liku. Jadikan setiap tantangan sebagai kesempatan untuk tumbuh dan berkembang", + "Cinta sejati adalah ketika dua jiwa saling melengkapi, memberi dukungan dan menginspirasi satu sama lain untuk menjadi yang terbaik", + "Hidup adalah anugerah yang berharga. Nikmati setiap momen dan hargai kebahagiaan sederhana di sekitar kita", + "Perubahan adalah satu-satunya konstanta dalam hidup. Yang bertahan adalah mereka yang dapat beradaptasi dengan fleksibilitas", + "Kebersamaan adalah fondasi yang kuat dalam membangun hubungan yang langgeng dan bermakna", + "Masa depan adalah milik mereka yang memiliki imajinasi, tekad, dan kerja keras untuk mewujudkan visi mereka", + "Ketika kita berbagi dengan orang lain, kita tidak hanya mengurangi beban mereka, tetapi juga memperkaya hati kita sendiri", + "Kesuksesan sejati adalah ketika kita mencapai tujuan kita sambil tetap mempertahankan integritas dan empati terhadap orang lain", + "Rasa syukur adalah kunci untuk mengalami kebahagiaan yang sejati dalam hidup. Mencintai apa yang kita miliki adalah kunci kepuasan yang tak ternilai", + }; + + public void setNewWordsToType() { + Random random = new Random(); + int angkaRandom = random.nextInt(10); + wordsToType = wordsToTypeList[angkaRandom]; + } + + // TODO (4) : Buat method addResult yang mana digunakan untuk menambahkan typer + // yangtelah selesai (mengetik semua kata), ke dalam list race standing. + public synchronized void addResult(Result result) { + raceStanding.add(result); + } + + public void printRaceStanding() { + System.out.println("\nKlasemen Akhir Type Racer"); + System.out.println("=========================\n"); + + // TODO (5) : Tampilkan klasemen akhir dari kompetisi, dengan format + // {posisi}. {nama} = {waktu penyelesaian dalam detik} detik + int index = 1; + + for (Result result : raceStanding) { + System.out.printf("%d. %s - %.2f detik\n", index, result.getName(), + result.getFinishTime() / 1000.0); + index += 1; + } + } + + public void startRace() throws InterruptedException { + // TODO (6) : jalankan kompetisi + for (Typer racer : raceContestant) { + racer.start(); + } + + // TODO (7) : selaman semua peserta belum selesai, maka tampilkan + // SS + // Setiap 2 detik + while (raceContestant.size() != raceStanding.size()) { + Thread.sleep(2000); + System.out.println("\nTyping Progress ..."); + System.out.println("================\n"); + + for (Typer racer : raceContestant) { + System.out.printf("- %s\t=> %s\n", racer.getBotName(), racer.getWordsTyped()); + System.out.println("-".repeat(100)); + } + + System.out.println("\n" + "#".repeat(100)); + } + + // TODO (8) : Tampilkan race standing setelah semua typer selesai + for (Typer racer : raceContestant) { + racer.join(); + } + + printRaceStanding(); + } +} diff --git a/src/H071221099/Pertemuan_8/TugasPraktikum.java b/src/H071221099/Pertemuan_8/TugasPraktikum.java new file mode 100644 index 0000000..4864cd0 --- /dev/null +++ b/src/H071221099/Pertemuan_8/TugasPraktikum.java @@ -0,0 +1,101 @@ +package no3; + +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class TugasPraktikum { + + public static void main(String[] args) { + int numData = 4; + + UiThread uiThread = new UiThread(numData); + + ExecutorService executor = Executors.newFixedThreadPool(3); + + uiThread.start(); + + for (int i = 0; i < numData; i++) { + executor.execute(new BackgroundThread(uiThread, TaskTimeHelper.generateRandomTimeExecution())); + } + executor.shutdown(); + } +} + +class UiThread extends Thread { + private int numBackgroundThreads; + private int numThreadsSuccess = 0; + private int numThreadsFailed = 0; + private int timeExecution = 0; + + public UiThread(int numBackgroundThreads) { + this.numBackgroundThreads = numBackgroundThreads; + } + + public void run() { + System.out.println("Start load " + numBackgroundThreads + " Data"); + while ((numThreadsSuccess + numThreadsFailed) < numBackgroundThreads) { + try { + Thread.sleep(1000); + timeExecution++; + System.out.printf("Loading... (%ds)\n", timeExecution); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + System.out.println("\nTask Finish."); + System.out.println("Time Execution : " + timeExecution + "s"); + if (numThreadsFailed == 0) { + System.out.println("All data is successfully loaded"); + } else if (numThreadsSuccess == 0) { + System.out.println("All data failed to load"); + } else { + System.out.println( + numThreadsSuccess + " Data Successfully loaded & " + numThreadsFailed + " Data failed to load"); + } + } + + public synchronized void incrementNumThreadsSuccess() { + this.numThreadsSuccess++; + } + + public synchronized void incrementNumThreadsFailed() { + this.numThreadsFailed++; + } +} + +class BackgroundThread extends Thread { + private UiThread uiThread; + private int timeExecution; + + public BackgroundThread(UiThread uiThread, int timeExecution) { + this.uiThread = uiThread; + this.timeExecution = timeExecution; + } + + public void run() { + try { + for (int i = 1; i <= timeExecution; i++) { + TimeUnit.SECONDS.sleep(1); + if (i * 1000 > 2000) { + System.out.println("Request Timeout"); + uiThread.incrementNumThreadsFailed(); + return; + } + } + uiThread.incrementNumThreadsSuccess(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + +} + +class TaskTimeHelper { + static int generateRandomTimeExecution() { + Random random = new Random(); + int randomNumber = random.nextInt(6) + 1; + return randomNumber; + } +} diff --git a/src/H071221099/Pertemuan_9/.vscode/settings.json b/src/H071221099/Pertemuan_9/.vscode/settings.json new file mode 100644 index 0000000..7b016a8 --- /dev/null +++ b/src/H071221099/Pertemuan_9/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_9/hello/.gitattributes b/src/H071221099/Pertemuan_9/hello/.gitattributes new file mode 100644 index 0000000..097f9f9 --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/.gitattributes @@ -0,0 +1,9 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf + +# These are Windows script files and should use crlf +*.bat text eol=crlf + diff --git a/src/H071221099/Pertemuan_9/hello/.gitignore b/src/H071221099/Pertemuan_9/hello/.gitignore new file mode 100644 index 0000000..1b6985c --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/.gitignore @@ -0,0 +1,5 @@ +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build diff --git a/src/H071221099/Pertemuan_9/hello/.vscode/settings.json b/src/H071221099/Pertemuan_9/hello/.vscode/settings.json new file mode 100644 index 0000000..b84f89c --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive", + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/src/H071221099/Pertemuan_9/hello/app/build.gradle b/src/H071221099/Pertemuan_9/hello/app/build.gradle new file mode 100644 index 0000000..800082d --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/app/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'application' + id 'org.openjfx.javafxplugin' version '0.0.13' +} + +repositories { + // Use Maven Central for resolving dependencies. + mavenCentral() +} + +dependencies { + // Use JUnit Jupiter for testing. + testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1' + + // This dependency is used by the application. + implementation 'com.google.guava:guava:31.1-jre' +} + +// Apply a specific Java toolchain to ease working on different environments. +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + +javafx { + version = "17" + modules = [ 'javafx.controls' ] +} + +application { + // Define the main class for the application. + mainClass = 'hello.App' +} + +tasks.named('test') { + // Use JUnit Platform for unit tests. + useJUnitPlatform() +} diff --git a/src/H071221099/Pertemuan_9/hello/app/src/main/java/hello/App.java b/src/H071221099/Pertemuan_9/hello/app/src/main/java/hello/App.java new file mode 100644 index 0000000..c6eac43 --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/app/src/main/java/hello/App.java @@ -0,0 +1,352 @@ +package hello; + + +import javafx.application.Application; +import javafx.geometry.Pos; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.StackPane; +import javafx.scene.layout.VBox; +import javafx.scene.text.Font; +import javafx.stage.Stage; +import javafx.scene.layout.Background; +import javafx.scene.layout.BackgroundImage; +import javafx.scene.layout.BackgroundPosition; +import javafx.scene.layout.BackgroundRepeat; +import javafx.scene.layout.BackgroundSize; + +public class App extends Application { + private Stage stage; + public void start(Stage primaryStage) throws Exception{ + + stage = primaryStage; + stage.getIcons().add(new Image("D:\\javafx\\hello\\app\\src\\main\\resources\\image\\kal.jpg")); + stage.setResizable(false); + showFirstScene(); + stage.show(); + } + + + private void showFirstScene(){ + Label label = new Label(" TUNGITUNG "); + label.setStyle("-fx-font-family: 'Times New Roman'; -fx-font-size: 20px; -fx-text-fill: #020201;-fx-background-color: GREEN; -fx-background-radius: 90;"); + VBox vbox1 =new VBox(50,label); + vbox1.setStyle("-fx-background-color: "); + vbox1.setAlignment(Pos.TOP_CENTER); + + + // ImageView imageView = new ImageView(); + // imageView.setFitHeight(180); + // imageView.setFitWidth(180); + // VBox vbox2 = new VBox(15, imageView); + // vbox2.setAlignment(Pos.CENTER); + + Button button = new Button("Click To Start"); + button.setFont(new Font(40)); + button.setStyle("-fx-font-weight: bold;-fx-font: 30 The Northern;-fx-background-color: GREEN;-fx-text-fill: #020201;-fx-background-radius: 100"); + + VBox vbox3=new VBox(15, button); + vbox3.setAlignment(Pos.TOP_CENTER); + vbox3.setStyle("-fx-background-color: "); + + VBox asli = new VBox(45,vbox1,vbox3); + asli.setAlignment(Pos.CENTER); + asli.setStyle("D:\\javafx\\hello\\app\\src\\main\\resources\\image\\278a5d3f73002382ad3a3f6baebb5e43.jpg"); + // asli.getChildren().addAll(vbox1,vbox2,vbox3); + + Image backgroundImage = new Image("image/back.jpg"); + BackgroundImage background = new BackgroundImage(backgroundImage, + BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, + BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT); + Background backg = new Background(background); + asli.setBackground(backg); + + Scene scene1 = new Scene(asli,500,500); + stage.setTitle("CALCULATORMU"); + stage.setScene(scene1); + + + button.setOnAction(e -> showSecondscene()); + + } + + private void showSecondscene(){ + + Label menu = new Label(" PILIH MENU "); + menu.setAlignment(Pos.TOP_CENTER); + menu.setStyle("-fx-font-weight: bold;-fx-background-color: #2494b0e5;-fx-text-fill: BLACK;-fx-background-radius: 10;-fx-border-color: BLACK"); + menu.setFont(Font.font("Comic Sans MS", 26)); + VBox vbox1 = new VBox(40, menu); + vbox1.setAlignment(Pos.TOP_CENTER); + + + + Button button1 = new Button("Hitung Luas & Keliling Persegi"); + button1.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 10px; -fx-font-weight: bold; -fx-background-color: #a38d20; -fx-text-fill: #020201; -fx-background-radius: 100;"); + + ImageView imageView = new ImageView(); + String foto = "file:D:/persegi1.jpg"; + Image image = new Image(foto); + imageView.setImage(image); + imageView.setFitHeight(100); + imageView.setFitWidth(100); + + Button button2 = new Button("Hitung Luas & Keliling PersegiPanjang"); + button2.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 10px; -fx-font-weight: bold; -fx-background-color: #a38d20; -fx-text-fill: #020201; -fx-background-radius: 100;"); + + ImageView imageView2 = new ImageView(); + String foto2 = "file:D:/prsegipanjang.png"; + Image image2 = new Image(foto2); + imageView2.setImage(image2); + imageView2.setFitHeight(100); + imageView2.setFitWidth(100); + + Button button3 = new Button("Kalkulator"); + button3.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 10px; -fx-font-weight: bold; -fx-background-color: #a38d20; -fx-text-fill: #020201; -fx-background-radius: 100;"); + + ImageView imageView3 = new ImageView(); + String foto3 = "file:D:/lope.png"; + Image image3 = new Image(foto3); + imageView3.setImage(image3); + imageView3.setFitHeight(150); + imageView3.setFitWidth(150); + + VBox vbox2 = new VBox(20, imageView,button1) ; + vbox2.setAlignment(Pos.TOP_CENTER); + VBox vbox3 = new VBox(20, imageView2,button2) ; + vbox3.setAlignment(Pos.TOP_CENTER); + VBox vbox4 = new VBox(5, imageView3,button3); + vbox4.setAlignment(Pos.TOP_CENTER); + + HBox hbox = new HBox(15,vbox2,vbox3); + hbox.setAlignment(Pos.TOP_CENTER); + HBox hbox2 = new HBox(15,vbox4); + hbox2.setAlignment(Pos.TOP_CENTER); + + + VBox vbox = new VBox(10,vbox1,hbox,hbox2); + vbox.setAlignment(Pos.CENTER); + vbox.setStyle("-fx-background-color: #202922;"); + Scene scene2 = new Scene((vbox),500,500); + button1.setOnAction(e -> KalkulatorPersegi()); + button2.setOnAction(e -> KalkulatorPersegipanjang()); + button3.setOnAction(e->kalkulatorcuy() ); + stage.setScene(scene2); + } + + + private void KalkulatorPersegi(){ + Button luaspersegi = new Button("Hitung Luas"); + Button kelilingpersegi = new Button("Hitung Keliling"); + Button clear= new Button("CLEAR"); + Button balikmenu = new Button("KEMBALI KE MENU"); + TextField sisipersegi = new TextField(); + sisipersegi.setPromptText("masukin sisi"); + Label labelsisipersegi = new Label("MASUKKAN PANJANG SISI"); + labelsisipersegi.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 20px; -fx-background-color: #93aa14; -fx-text-fill: #020201; -fx-background-radius: 10; -fx-border-color: WHITE;"); + Label labelhasilpersegi = new Label("Persegi = "); + labelhasilpersegi.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 20px; -fx-background-color: #93aa14; -fx-text-fill: #020201; -fx-background-radius: 10; -fx-border-color: WHITE;"); + VBox vboxpersegi = new VBox(labelsisipersegi,sisipersegi,labelhasilpersegi,luaspersegi,kelilingpersegi,clear,balikmenu); + vboxpersegi.setAlignment(Pos.CENTER); + vboxpersegi.setStyle("-fx-background-color: #202922;"); + Scene scene3 = new Scene(vboxpersegi,500,500); + + stage.setScene(scene3); + + luaspersegi.setOnAction(event ->{ + int angkapersegi= Integer.parseInt(sisipersegi.getText()); + int luaspersegihasil= angkapersegi*angkapersegi; + labelhasilpersegi.setText("Luas Persegi = "+luaspersegihasil);}); + kelilingpersegi.setOnAction(event ->{ + int angkapersegi= Integer.parseInt(sisipersegi.getText()); + int kelilingpersegihasil= angkapersegi*4; + labelhasilpersegi.setText("Keliling Persegi = "+kelilingpersegihasil);}); + clear.setOnAction(event->{ + sisipersegi.clear(); + labelhasilpersegi.setText("");}); + balikmenu.setOnAction(event->{ + showSecondscene(); + }); + + } + private void KalkulatorPersegipanjang(){ + Button luaspersegipanjang = new Button("Hitung Luas"); + Button kelilingpersegipanjang = new Button("Hitung Keliling"); + Button clear2= new Button("CLEAR"); + Button balikmenu = new Button("KEMBALI KE MENU"); + TextField sisipersegipanjang = new TextField(); + sisipersegipanjang.setPromptText("masukin panjang"); + TextField lebarpersegipanjang = new TextField(); + lebarpersegipanjang.setPromptText("masukin lebar"); + Label labelsisipersegipanjang = new Label("MASUKKAN PANJANG SISI"); + labelsisipersegipanjang.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 20px; -fx-background-color: #93aa14; -fx-text-fill: #020201; -fx-background-radius: 10; -fx-border-color: WHITE;"); + Label labelsisipersegipanjang2 = new Label("MASUKKAN LEBAR SISI"); + labelsisipersegipanjang2.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 20px; -fx-background-color: #93aa14; -fx-text-fill: #020201; -fx-background-radius: 10; -fx-border-color: WHITE;"); + Label labelhasilpersegipanjang = new Label("PersegiPanjang ="); + labelhasilpersegipanjang.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 20px; -fx-background-color: #93aa14; -fx-text-fill: #020201; -fx-background-radius: 10; -fx-border-color: WHITE;"); + VBox vboxpersegi = new VBox(labelsisipersegipanjang,sisipersegipanjang,labelsisipersegipanjang2,lebarpersegipanjang,labelhasilpersegipanjang,luaspersegipanjang,kelilingpersegipanjang,clear2,balikmenu); + vboxpersegi.setAlignment(Pos.CENTER); + vboxpersegi.setStyle("-fx-background-color: #202922;"); + + Scene scene3 = new Scene(vboxpersegi,500,500); + stage.setScene(scene3); + + luaspersegipanjang.setOnAction(event ->{ + int panjangpersegipanjang= Integer.parseInt(sisipersegipanjang.getText()); + int lebarintpersegipanjang= Integer.parseInt(lebarpersegipanjang.getText()); + int luaspersegipanjanghasil= panjangpersegipanjang*lebarintpersegipanjang; + labelhasilpersegipanjang.setText("Luas Persegi Panjang = "+luaspersegipanjanghasil);}); + kelilingpersegipanjang.setOnAction(event ->{ + int panjangpersegipanjang= Integer.parseInt(sisipersegipanjang.getText()); + int lebarintpersegipanjang= Integer.parseInt(lebarpersegipanjang.getText()); + int kelilingpersegipanjanghasil= panjangpersegipanjang+panjangpersegipanjang+lebarintpersegipanjang+lebarintpersegipanjang; + labelhasilpersegipanjang.setText("Keliling Persegi Panjang = "+kelilingpersegipanjanghasil);}); + clear2.setOnAction(event->{ + sisipersegipanjang.clear(); + lebarpersegipanjang.clear(); + labelhasilpersegipanjang.setText("");}); + balikmenu.setOnAction(event->{ + showSecondscene(); + }); + + } + + private void kalkulatorcuy(){ + Label label = new Label(" CALCULATORKITA "); + label.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 20px; -fx-background-color: #93aa14; -fx-text-fill: #020201; -fx-background-radius: 60; -fx-border-color: WHITE;"); + + VBox vbox1 =new VBox(10,label); + vbox1.setAlignment(Pos.TOP_CENTER); + + + TextField imput1 = new TextField(); + imput1.setPromptText("masukin angka"); + TextField imput2 = new TextField(); + imput2.setPromptText("masukin angka"); + + GridPane gridpane = new GridPane(); + gridpane.setVgap(10); + gridpane.add(imput1,0,0); + gridpane.add(imput2,0,1); + gridpane.setAlignment(Pos.CENTER); + + // VBox vbox2 = new VBox(10, imput1,imput2); + // vbox2.setAlignment(Pos.TOP_CENTER); + + + Label labelhasil1 = new Label(" HASIL = "); + labelhasil1.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 20px; -fx-background-color: #93aa14; -fx-text-fill: #020201; -fx-background-radius: 60"); + Label labelhasil2 = new Label(); + labelhasil2.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 20px; -fx-background-color: #93aa14; -fx-text-fill: #020201; -fx-background-radius: 60"); + + HBox hbox1 = new HBox(10, labelhasil1,labelhasil2); + hbox1.setAlignment(Pos.CENTER); + + Button button1 = new Button("+"); + button1.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 15px; -fx-font-weight: bold; -fx-background-color: #db6e02; -fx-text-fill: #020201; -fx-background-radius: 100;"); + Button button2 = new Button("-"); + button2.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 15px; -fx-font-weight: bold; -fx-background-color: #db6e02; -fx-text-fill: #020201; -fx-background-radius: 100;"); + Button button3 = new Button("X"); + button3.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 15px; -fx-font-weight: bold; -fx-background-color: #db6e02; -fx-text-fill: #020201; -fx-background-radius: 100;"); + Button button4 = new Button("/"); + button4.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 15px; -fx-font-weight: bold; -fx-background-color: #db6e02; -fx-text-fill: #020201; -fx-background-radius: 100;"); + + HBox hbox2= new HBox(10,button1,button2,button3,button4 ); + hbox2.setAlignment(Pos.TOP_CENTER); + + + Button button5 = new Button("CLEAR"); + button5.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 10px; -fx-font-weight: bold; -fx-background-color: #a38d20; -fx-text-fill: #020201; -fx-background-radius: 100;"); + Button button6 = new Button("BACK TO HOME"); + button6.setStyle("-fx-font-family: 'Comic Sans MS'; -fx-font-size: 10px; -fx-font-weight: bold; -fx-background-color: #a38d20; -fx-text-fill: #020201; -fx-background-radius: 100;"); + + VBox vbox3 = new VBox(10,button5,button6); + vbox3.setAlignment(Pos.TOP_CENTER); + + VBox vboxasli = new VBox(10, vbox1,gridpane,hbox1,hbox2,vbox3); + vboxasli.setAlignment(Pos.CENTER); + vboxasli.setStyle("-fx-background-color: #202922;"); + + + Scene scene4 = new Scene(vboxasli,500,500); + stage.setScene(scene4); + + button1.setOnAction(a->{ + double angka1=Double.parseDouble(imput1.getText()); + double angka2=Double.parseDouble(imput2.getText()); + double hasil = angka1+angka2; + if(hasil%1==0){ + int hasilInt=(int)hasil; + // String hasilText = String.valueOf(hasilInt); + labelhasil2.setText(""+hasilInt); + } + else{ + labelhasil2.setText(""+hasil); + } + }); + button2.setOnAction(a->{ + double angka1=Double.parseDouble(imput1.getText()); + double angka2=Double.parseDouble(imput2.getText()); + double hasil = angka1-angka2; + if(hasil%1==0){ + int hasilInt=(int)hasil; + // String hasilText = String.valueOf(hasilInt); + labelhasil2.setText(""+hasilInt); + } + else{ + labelhasil2.setText(""+hasil); + } + }); + button3.setOnAction(a->{ + double angka1=Double.parseDouble(imput1.getText()); + double angka2=Double.parseDouble(imput2.getText()); + double hasil = angka1*angka2; + if(hasil%1==0){ + int hasilInt=(int)hasil; + // String hasilText = String.valueOf(hasilInt); + labelhasil2.setText(""+hasilInt); + } + else{ + labelhasil2.setText(""+hasil); + } + }); + button4.setOnAction(a->{ + double angka1=Double.parseDouble(imput1.getText()); + double angka2=Double.parseDouble(imput2.getText()); + double hasil = angka1/angka2; + if(hasil%1==0){ + int hasilInt=(int)hasil; + // String hasilText = String.valueOf(hasilInt); + labelhasil2.setText(""+hasilInt); + } + else{ + labelhasil2.setText(""+hasil); + } + }); + button5.setOnAction(event->{ + imput1.clear(); + imput2.clear(); + labelhasil2.setText("");}); + button6.setOnAction(a->{showSecondscene();}); + + + + } + + + + + public static void main(String[] args) { + launch(args); + } + } + + diff --git a/src/H071221099/Pertemuan_9/hello/app/src/main/resources/image/back.jpg b/src/H071221099/Pertemuan_9/hello/app/src/main/resources/image/back.jpg new file mode 100644 index 0000000..33c3203 Binary files /dev/null and b/src/H071221099/Pertemuan_9/hello/app/src/main/resources/image/back.jpg differ diff --git a/src/H071221099/Pertemuan_9/hello/app/src/main/resources/image/kal.jpg b/src/H071221099/Pertemuan_9/hello/app/src/main/resources/image/kal.jpg new file mode 100644 index 0000000..b2ee726 Binary files /dev/null and b/src/H071221099/Pertemuan_9/hello/app/src/main/resources/image/kal.jpg differ diff --git a/src/H071221099/Pertemuan_9/hello/gradle/wrapper/gradle-wrapper.properties b/src/H071221099/Pertemuan_9/hello/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..37aef8d --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/src/H071221099/Pertemuan_9/hello/gradlew b/src/H071221099/Pertemuan_9/hello/gradlew new file mode 100644 index 0000000..aeb74cb --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/gradlew @@ -0,0 +1,245 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/src/H071221099/Pertemuan_9/hello/gradlew.bat b/src/H071221099/Pertemuan_9/hello/gradlew.bat new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/H071221099/Pertemuan_9/hello/settings.gradle b/src/H071221099/Pertemuan_9/hello/settings.gradle new file mode 100644 index 0000000..6786b5c --- /dev/null +++ b/src/H071221099/Pertemuan_9/hello/settings.gradle @@ -0,0 +1,16 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/8.1.1/userguide/multi_project_builds.html + */ + +plugins { + // Apply the foojay-resolver plugin to allow automatic download of JDKs + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' +} + +rootProject.name = 'hello' +include('app')