diff --git a/IndexPoint.java b/IndexPoint.java index 8b13789..4c3ef5d 100644 --- a/IndexPoint.java +++ b/IndexPoint.java @@ -1 +1,35 @@ - +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package task1; + +import java.util.Scanner; + +/** + * + * @author ASUS + */ +public class IndexPoint { + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + System.out.print("Masukkan nilai UTS : "); + int UTS = input.nextInt(); + System.out.print("Masukkan nilai UAS : "); + int UAS = input.nextInt(); + System.out.print("Masukkan nilai Quiz: "); + int Quiz = input.nextInt(); + double NilaiTotal = 0.35*UTS + 0.4*UAS + 0.25*Quiz; + if (NilaiTotal >=85 && NilaiTotal<=100) + System.out.println("Excelent"); + else if(NilaiTotal >=75 && NilaiTotal <=84) + System.out.println("Very Good"); + else if(NilaiTotal >=65 && NilaiTotal <=74) + System.out.println("Good"); + else if(NilaiTotal >=50 && NilaiTotal <= 64) + System.out.println("Accepted"); + else + System.out.println("Failed"); + } +} diff --git a/PrimeNumber.java b/PrimeNumber.java index 8b13789..883f6ba 100644 --- a/PrimeNumber.java +++ b/PrimeNumber.java @@ -1 +1,35 @@ - +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package task1; + +import java.util.Scanner; + +/** + * + * @author ASUS + */ +public class PrimeNumber { + + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + System.out.println("Masukkan angka: "); + int x = input.nextInt(); + int y = 0; + for (int i = 1;i<=x;i++) + { + if (x%i==0) + y+=1; + } + + if (y==2) + System.out.println("Bilangan Prima"); + else + System.out.println("Bukan bilangan prima"); + + + } + +} diff --git a/TemperatureConvert.java b/TemperatureConvert.java index e69de29..8a2b2d8 100644 --- a/TemperatureConvert.java +++ b/TemperatureConvert.java @@ -0,0 +1,45 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package task1; + +import java.util.Scanner; + +/** + * + * @author ASUS + */ +public class TemperatureConvert { + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + System.out.print("Masukkan suhu celcius: "); + int celcius = input.nextInt(); + int reamur = celcius*4/5; + int fahrenheit = celcius*9/5+32; + int kelvin = celcius+273; + int menu = 1; + while (menu>0){ + System.out.println("Menu convert"); + System.out.println("1. Reamur"); + System.out.println("2. Fahrenheit"); + System.out.println("3. Kelvin"); + System.out.println("0. Exit"); + System.out.print("Pilih menu : "); + menu = input.nextInt(); + switch (menu){ + case 1: + System.out.println(reamur); + break; + case 2: + System.out.println(fahrenheit); + break; + case 3: + System.out.println(kelvin); + break; + } + } + + } +}