# Untitled

a guest
Oct 8th, 2017
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. package L05MethodsDebugingAndTrubleshooting.exercices;
2.
3. import java.text.DecimalFormat;
4. import java.util.ArrayList;
5. import java.util.List;
6. import java.util.Scanner;
7.
8. public class p08_CenterPoint {
9. public static void main(String[] args) {
10. Scanner scanner = new Scanner(System.in);
11. double a1 = Double.parseDouble(scanner.nextLine());
12. double a2 = Double.parseDouble(scanner.nextLine());
13. double b1 = Double.parseDouble(scanner.nextLine());
14. double b2 = Double.parseDouble(scanner.nextLine());
15. scanner.close();
16.
17. double lengthA = CenterPoint(a1, a1);
18. double lengthB = CenterPoint(b1, b2);
19.
20. List<String> distance = new ArrayList<>();
21.
22. if (lengthA <= lengthB){
25. }else {
28. }
29. System.out.println("(" + String.join(", ", distance) + ")");
30.
31. }
32. public static double CenterPoint(double x, double y) {
33. double length = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
34. return length;
35. }
36.
37. public static String ToString(Double a){
38. DecimalFormat decimalFormat = new DecimalFormat("#.###########");
39. String s = decimalFormat.format(a);
40. return s;
41. }
42. }
RAW Paste Data