Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Buat Sebuah Project Dengan Nama "latihan", kemudian buat sebuah class dengan nama "rumus" ketikkan code dibawah.
- Setelah itu, Buat class baru dengan nama "DisplayLuas_Keliling_Lingkaran", Kemudian ketikkan codding tahap ke-2 dibawah, baru di jalankan
- ---------------------------------------------------------------------------------------------------------------------
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package latihan;
- /**
- *
- * @author Bengkel IT Lhokseumawe
- */
- public class rumus {
- private float pi= (float) 3.14;
- private float radius=5;
- public void luas(){
- float luas= pi*radius*radius;
- System.out.println("Luas: "+luas);
- }
- public void keliling(){
- float keliling= 2* pi*radius;
- System.out.println("Keliling: "+keliling);
- }
- }
- CODDING TAHAP KE-II
- --------------------
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package latihan;
- /**
- *
- * @author BIT
- */
- public class DisplayLuas_Keliling_Lingkaran {
- public static void main(String[]args){
- rumus display1= new rumus();
- rumus display2= new rumus();
- display1.luas();
- display2.keliling();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement