Tugas Java

tugas dari mas haritz

  1. menghitung persegi panjang
  2. menghitung segitiga
  3. menghitung luas lingkaran
  4. menghitung diskon
public class persegipanjang{
public static void main(String [] args){
double luas;
int panjang = 6;
int lebar = 3;
panjang * lebar;
System.out.println ("luas persegi panjang = "+luas);
}
}

public class lingkaran{
public static void main (String [] args){
double luas;

int r = 10;
float pi = 3.14f;
luas = pi * (r * r);
System.out.println("luas lingkaran =" +luas);
}
}

public class segitiga{
public static void main(String [] args){
double luas;
int alas = 20;
int tinggi = 10;
luas = alas * tinggi / 2;
System.out.println("luas segitiga = "+luas);
}
}

public class diskon{
public static void main(String [] args){

int harga = 50000;
double diskon = 0.25;
diskon = harga * diskon;
System.out.println("diskon = "+diskon);
}
}

http://pastebin.com/9JRDYbdS”>klik disini

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s