package kalkulator;
import java.util.Scanner;
public class kalkulator {
public static void main(String[] args)
{
// TODO Auto-generated
method stub
Scanner hitung=new Scanner(System.in);
int F, A, s, w, m, a, P,
W, g;
System.out.println("+-------------------------------------------------------------------------------------+");
System.out.println("| Selamat Datang di PhysCal |");
System.out.println("+-------------------------------------------------------------------------------------+");
System.out.println("| Formulas List
|");
System.out.println("+-------------------------------------------------------------------------------------+");
System.out.println("| 1. Tekanan
|");
System.out.println("| 2. Usaha
|");
System.out.println("| 3. Gaya
| ");
System.out.println("| 4. Berat
|");
System.out.println("+-------------------------------------------------------------------------------------+");
System.out.println();
System.out.println();
System.out.println();
System.out.print("Masukkan Kode
Formula : ");
String instruksi=hitung.next();
switch(instruksi){
case "1":
System.out.println("Menghitung
Tekanan (P) ");
System.out.println("P=F/A");
System.out.print("Gaya(F) :
");
F = hitung.nextInt ();
System.out.print("Luas
Permukaan (A) : ");
A = hitung.nextInt ();
P = (F/A);
System.out.println("Tekanan (P)=
"+P
);
break;
case "2":
System.out.println("Menghitung
Usaha (W) ");
System.out.println("W=F*s");
System.out.print("Gaya(F) :
");
F = hitung.nextInt ();
System.out.print("Jarak (s) :
");
s = hitung.nextInt ();
W = (F*s);
System.out.println("Usaha (W)=
"+W
);
break;
case "3":
System.out.println("Menghitung
Gaya (F) ");
System.out.println("F=m*a");
System.out.print("Massa (m) :
");
m = hitung.nextInt ();
System.out.print("Percepatan
(a) : ");
a = hitung.nextInt ();
F = (m*a);
System.out.println("Gaya (F)=
"+F
);
break;
case "4":
System.out.println("Menghitung
Berat (w) ");
System.out.println("w=m*g");
System.out.print("Massa (m) :
");
m = hitung.nextInt ();
System.out.print("Percepatan
Gravitasi (g) : ");
g = hitung.nextInt ();
w = (m*g);
System.out.println("Berat (w)=
"+w
);
break;
default:
System.out.println("Kode Formula
Salah");
}
System.out.println("*****************TERIMA
KASIH TELAH MENGGUNAKAN PHYSCAL*****************");
}
}
Tidak ada komentar:
Posting Komentar