Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Solution {
- public static void main(String[] args) {
- String s1,s2,s3,s4; int x = 0;
- Scanner masuk = new Scanner(System.in);
- s1 = masuk.nextLine();
- s2 = masuk.nextLine();
- s3 = masuk.nextLine();
- s4 = masuk.nextLine();
- if(s1.equalsIgnoreCase("hilang"))
- {
- x++; s1 = "0";
- }
- if(s2.equalsIgnoreCase("hilang"))
- {
- x++; s2 = "0";
- }
- if(s3.equalsIgnoreCase("hilang"))
- {
- x++; s3 = "0";
- }
- if(s4.equalsIgnoreCase("hilang"))
- {
- x++; s4 = "0";
- }
- double ep = Double.valueOf(s1);
- double m = Double.valueOf(s2);
- double g = Double.valueOf(s3);
- double h = Double.valueOf(s4);
- if(x>=2)
- {
- System.out.print("GAK ADA");
- }
- else if(x==1)
- { //EP=M.G.H
- if(ep==0)
- {
- ep = m*g*h;
- ep = Math.round(ep);
- System.out.printf("%.2f J",ep);
- }
- else if(m==0)
- {
- m = ep/(g*h);
- m = Math.round(m);
- System.out.printf("%.2f Kg",m);
- }
- else if(g==0)
- {
- g = ep / (m*h);
- g = Math.round(g);
- System.out.printf("%.2f m/s^2",g);
- }
- else if(h==0)
- {
- h = ep / (m*g);
- h = Math.round(h);
- System.out.printf("%.2f m",h);
- }
- }
- else if(x==0)
- {
- if(ep==(m*g*h))
- {
- System.out.print("WOW");
- }
- else
- {
- System.out.print("APA SIH");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement