Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. package javaapplication12;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class JavaApplication12 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         double x1 = Double.parseDouble(scanner.next());
  10.         double y1 = Double.parseDouble(scanner.next());
  11.         double x2 = Double.parseDouble(scanner.next());
  12.         double y2 = Double.parseDouble(scanner.next());
  13.  
  14.         double p1 = Math.abs(x1 - x2);
  15.         double p2 = Math.abs(y1 - y2);
  16.  
  17.         double p3 = p1 * p2;
  18.         double p4 = 2 * (p1 + p2);
  19.        
  20.         System.out.println(p3);
  21.         System.out.println( p4);
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement