Not seeing a Scroll to Top Button? Go to our FAQ page for more info. [Java] Menghitung volume tabung dan kerucut | -

My Imaginations

-
Follow Me

[Java] Menghitung volume tabung dan kerucut



By  Galeh Fatma Eko Ardiansa     November 20, 2013     
latihan pemrograman java menghitung volume kerucut dan tabung, dimana user menginputkan bilangan genap maka yang dihitung adalah volume kerucut dan sebaliknya

package latian1a;

import java.util.Scanner;

public class latian7a {
    static Scanner in = new Scanner(System.in);
         public static void main(String[] args) {     
        float tinggi,hasil,diameter;
        System.out.print("Masukkan Diameter : ");diameter= in.nextFloat();
        System.out.print("Masukkan Tinggi   : ");tinggi= in.nextFloat();
             System.out.println(bilangan(diameter,tinggi));
            
     }
              public static float bilangan(float a,float t){
                  float x = 0,y = 0;{
       if (a%2 == 0){
           x = volumekerucut(a,t); 
             System.out.println("Volume Kerucut  adalah : " +x);    
         }
         else if (a%2 == 1)
           y = volumetabung(a,t); 
             System.out.println("Volume Tabung adalah : "+y);
            
              }return x; 
           
              }
   public static float volumekerucut(float a, float t){
   float volume = (float) ((3.14*(a/2)*(a/2)*t)/3);
   return volume;}

    public static float volumetabung(float a, float t){
    float volume = (float) ((3.14*(a/2)*(a/2)*t));
    return volume;}
}




caranya kosongkan form project netbeans
trus tinggal Copas aja sob...hehe..

smoga bermanfaat...:) aamiin

About Galeh Fatma Eko Ardiansa

If you can dream it, you can do it | Genius is one percent inspiration and ninety-nine percent perspiration | If you don’t make mistakes, you’re not working on hard enough problems | The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart | I can't change the direction of the wind, but I can adjust my sails to always reach my destination.

Tidak ada komentar:

Posting Komentar


Formulir Kontak

Nama

Email *

Pesan *

Advertisement

Disqus Shortname