Advertisement
Guest User

CalculateExpression

a guest
Nov 15th, 2015
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CalculateExpression {
  4.  
  5.     public static void main(String[] args) {
  6.         double f1, f2, f3;
  7.         double f1b, f1e,f2b,f2e;
  8.         double a, b, c;
  9.         Scanner scan = new Scanner(System.in);
  10.         a = scan.nextDouble();
  11.         b = scan.nextDouble();
  12.         c = scan.nextDouble();
  13.         f1b = ((a*a) + (b*b)) / ((a*a) - (b*b));
  14.         f1e = (a+b+c) / (Math.sqrt(c));
  15.         f1 = Math.pow(f1b, f1e);
  16.         f2b = (a*a) + (b*b) - (c*c*c);
  17.         f2e = (a-b);
  18.         f2 = Math.pow(f2b, f2e);
  19.         f3 = Math.abs(((a+b+c)/3) - ((f1+f2)/2));
  20.         System.out.printf("F1 result: %.2f; F2 result: %.2f; Diff: %.2f",f1,f2,f3);
  21.     }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement