Advertisement
rangga_hrdme

nested_function_lingkaran

Jul 8th, 2021
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. class nestedFunc {
  2.     public static void main(String[] args) {
  3.         nestedFunc bola = new nestedFunc();
  4.         bola.permukaan(14);
  5.         bola.volume(14);
  6.  
  7.  
  8.     }
  9.     public void permukaan(double r){
  10.         System.out.println("Lingkaran");
  11.         double p =4 * (( 22 / 7) * r * r );
  12.         System.out.println("Permukaan: " + p);
  13.     }
  14.  
  15.     public void volume(double r){
  16.         double v = 4/3 * ((22/7) * r * r * r);
  17.         System.out.println("Volume: " + v);
  18.     }
  19.  
  20.  
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement