Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MethodsMoreExercise;
- import java.util.Scanner;
- public class O2CenterPoint {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int x1 = Integer.parseInt(scanner.nextLine());
- int y1 = Integer.parseInt(scanner.nextLine());
- int x2 = Integer.parseInt(scanner.nextLine());
- int y2 = Integer.parseInt(scanner.nextLine());
- printClosesToCenterPoint(x1, y1, x2, y2);
- }
- static void printClosesToCenterPoint(int x1, int y1, int x2, int y2) {
- int result1 = x1 + y1;
- int result2 = x2 + y2;
- if (result1 < result2) {
- System.out.printf("(%d, %d)",x1,y1);
- } else {
- System.out.printf("(%d, %d)",x2,y2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment