Advertisement
Guest User

2D RECTANGLE JAVA

a guest
Mar 13th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scan = new Scanner(System.in);
  9.         double x1 = Double.parseDouble(scan.nextLine());
  10.         double y1 = Double.parseDouble(scan.nextLine());
  11.         double x2 = Double.parseDouble(scan.nextLine());
  12.         double y2 = Double.parseDouble(scan.nextLine());
  13.         System.out.println(Math.abs(x1-x2)* Math.abs(y1 - y2));
  14.         System.out.println(2 * (Math.abs(x1-x2) + Math.abs(y1-y2)));
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement