Advertisement
Guest User

ComplexCalculation

a guest
May 15th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.lang.Math;
  4. import java.util.Scanner;
  5.  
  6. public class Problem4 {
  7. public static void main(String[] args) {
  8. Scanner scanner = new Scanner(System.in);
  9. double a = scanner.nextDouble();
  10. double b = scanner.nextDouble();
  11. double c = scanner.nextDouble();
  12.  
  13. double firstNumber = f1(a,b,c);
  14. System.out.printf("F1 result: "%.2f%n", firstNumber);
  15.  
  16. double secondNumber = f2(a,b,c);
  17. System.out.printf("F2 result: "%.2f%n", secondNumber );
  18. }
  19.  
  20. public static double f1(double a, double b, double c) {
  21.  
  22. double first = Math.pow(a, 2) + Math.pow(b, 2);
  23. double second = Math.pow(a, 2) - Math.pow(b, 2);
  24. double third = first / second;
  25. double fourth = (a + b + c);
  26. double fifth = fourth / Math.pow(c, 0.5);
  27. double sixth = Math.pow(third, fifth);
  28. return sixth;
  29. }
  30.  
  31. public static double f2(double a, double b, double c) {
  32.  
  33. double first = Math.pow(a, 2) + Math.pow(b, 2) - Math.pow(c, 3);
  34. double second = (a - b);
  35. double third = Math.pow(first, second);
  36. return third;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement