Anda di halaman 1dari 5

TUGAS

PEMROGRAMAN APLIKASI JAVA

KELOMPOK 7

1.
2.
3.
4.

Dimas Renaldi A.
Christianto Hari A.
M. Iqbal Ismail
Yulianto Baskoro

(06.2013.1.06277)
(06.2013.1.06180)
(06.2013.1.06169)
(06.2013.1.06175)

JURUSAN TEKNIK INFORMATIKA


FAKULTAS TEKNOLOGI INFORMASI
INSTITUT ADHI TAMA SURABAYA
2014/2015

Source Code Program nomor 1 :


import java.io.*;
import javax.swing.JOptionPane;
class inputkeyboard
{
public static void main (String[] args)
{
try
{
int a;
int b;
int tot1,tot2,tot3;
String hari;
String jam;
hari = JOptionPane.showInputDialog ("Berapa hari dalam seminggu anda
bekerja ? ");
a = Integer.parseInt(hari);
jam = JOptionPane.showInputDialog ("Berapa Jam rata-rata dalam sehari
anda bekerja ? :");
b = Integer.parseInt(jam);
tot1 = a*b;
tot2 = tot1*60;
tot3 = tot1*3600;
JOptionPane.showMessageDialog (null,"Anda sudah bekerja selama " + tot1 +
" jam atau "+ tot2 + " menit atau" + tot3 + " detik dalam seminggu ini ");
}
catch (Exception e)
{
JOptionPane.showMessageDialog (null,"Salah input data ");
}
}
}
Screen Shoot Program nomor 1 :

Source Code Nomer 2 :

import java.io.*;
public class soal2 {
public soal2() {
}
public static void main (String[] args) {
String nama="";
String alamat ="";
BufferedReader DataIn = new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Hai, siapa namamu?");
try{
nama=DataIn.readLine();
}
catch(IOException e){
}
System.out.println("Dimana rumahmu?");
try{
alamat=DataIn.readLine();
}
catch(IOException e){
}
System.out.println("ooo ternyata rumahnya "+nama+" di "+alamat+" yaa");
}
}
Screen Shoot Program Nomor 2 :

Source Code program nomor 3 :


a.

class halo
{
public static void main(String[]args)
{
System.out.println("Halo,"+"apa kabar!");
}
}
b.
class halo
{
public static void main(String[]args)
{
System.out.print("Halo,");
System.out.print("selamat");
System.out.print(" pagi");
}
}
Screen Shoot Program nomor 3 :
a.

b.

Analisa : program A penulisan dalam outputannya langsung 2 variabel


string, sedangkan probram B dalam terdapat pengulangan percetakan
sebanyak 3 kali.
Kelebihan : program A lebih efisien karna tidak terdapat pengulangan
percetakan.

Anda mungkin juga menyukai