Tk1-w3-s4-r1.docx

  • Uploaded by: Adhigian Kadarwadi
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Tk1-w3-s4-r1.docx as PDF for free.

More details

  • Words: 129
  • Pages: 2
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

More Documents from "Adhigian Kadarwadi"