Tugas Kelompok ke-1 (Minggu 3 / Sesi 4)
Buatlah program sederhana untuk mengubah satuan berat dari kilogram menjadi gram, ons dan pon 1 Kilogram = 2 pon 1 pon = 5 ons 1 ons = 100 gram Inputan yang dimasukkan dapat berupa bilangan bulat atau desimal Berikut contoh tampilannya :
/* author by : edwararmandes */ import java.util.Scanner; public class KonversiMassa { public static void main (String [] args){ int kg, pon, ons, gram; System.out.println("Masukan Jumlah Kilogram yang akan di Konversi : "); Scanner input = new Scanner(System.in); kg = input.nextInt(); pon = kg*2; ons = kg*10; gram = kg*1000; System.out.println(kg+" Kg Sama dengan :"); System.out.println("Pon = "+pon+" pon"); System.out.println("ons = "+ons+" ons"); System.out.println("gram = "+gram+" gram"); } }
COMP6598 – Introduction to Programming
COMP6598 – Introduction to Programming