Membuat Rumus Matematika dengan NetBeans

4:57 AM Unknown 0 Comments

Membuat Rumus Matematika dengan NetBeans

Note : Buat New Project dengan nama "Rumus".

package rumus;
import java.util.scanner;
import java.io.DataInputStream;
import java.util.Scanner;

public class Rumus
{
    public static void main(String[] args)
    {
        double a,b,s,n,kuadrat1,akar,kuadrat2,hasil,total;
        double p,q,atas,bawah,samping,hasilbawah;
       
      Scanner i = new Scanner(System.in);
        System.out.print("Masukkan a ");
            a = i.nextInt();
       
        System.out.print("Masukkan b ");
            b = i.nextInt();
           
        System.out.print("Masukkan s ");
            s = i.nextInt();
           
        System.out.print("Masukkan n ");
            n = i.nextInt();
           
atas=(a+b);
kuadrat1=Math.pow(atas,n);

bawah=((Math.min(a,b))-(Math.max(a,b)));
kuadrat2=Math.pow(bawah,n-1);
samping=a*b*s;
hasilbawah=samping*kuadrat2;

hasil=kuadrat1/hasilbawah;

total=Math.sqrt(hasil);



System.out.println("(a+b)pangkat n                         ="+kuadrat1);
System.out.println("a*b*s                                  ="+samping);
System.out.println("(min(a,b)-(max(a,b)pangkat n-1         ="+kuadrat2);
System.out.println("a*b*s(min(a,b)-(max(a,b))pangkat n-1   ="+hasilbawah);
System.out.println("======================================");
System.out.println("            (a+b)pangkat2             ");
System.out.println("--------------------------------------  : ");
System.out.println(" a*b*s(min(a,b)-(max(a,b))pangkat n-1 ");
System.out.println("");

System.out.println("Hasil = "+hasil );

System.out.println("Akar(Hasil) = ");

System.out.println("Hasil Akhir = "+total);
 
    }   
}

0 comments: