Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication9;
- import java.io.IOException;
- import java.util.Scanner;
- import static java.lang.Math.*;
- import java.text.NumberFormat;
- import java.text.ParseException;
- import java.util.Locale;
- public class JavaApplication9 {
- public static void main(String[] args) throws IOException, ParseException {
- Scanner scanner = new Scanner(System.in);
- NumberFormat f = NumberFormat.getInstance();
- String s = null;
- if(scanner.hasNextLine()){
- s = scanner.nextLine().trim();
- }
- float a = f.parse(s).floatValue();
- if(scanner.hasNextLine()){
- s = scanner.nextLine().trim();
- }
- float b = f.parse(s).floatValue();
- if(scanner.hasNextLine()){
- s = scanner.nextLine().trim();
- }
- float c = f.parse(s).floatValue();
- double f1 = pow(((pow(a,2) + pow(b,2)) / (pow(a,2) - pow(b,2))), ((a + b + c) / sqrt(c)));
- double f2 = pow((pow(a,2) + pow(b,2) - pow(c,3)), (a - b));
- double dif = abs(((a + b + c) / 3) - ((f1 + f2) / 2));
- System.out.printf(String.format(Locale.US, "F1 result: %.2f;", f1));
- System.out.printf(String.format(Locale.US, " F2 result: %.2f;", f2));
- System.out.printf(String.format(Locale.US, " Diff:%.2f", dif));
- }
- }
Add Comment
Please, Sign In to add comment