Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package javaapplication12;
  7.  
  8. import java.util.Scanner;
  9.  
  10. public class JavaApplication12 {
  11.     public static void main(String[] args) {
  12.         Scanner scanner = new Scanner(System.in);
  13.        
  14.         double width = Double.parseDouble(scanner.next());
  15.         double height = Double.parseDouble(scanner.next());
  16.        
  17.         double x1 = 0;
  18.         double x2 = width;
  19.         double y1 = 0;
  20.         double y2 = height;
  21.  
  22.         double p1 = Math.abs(x1 - x2);
  23.         double p2 = Math.abs(y1 - y2);
  24.  
  25.         double p3 = p1 * p2;
  26.         double p4 = 2 * (p1 + p2);
  27.        
  28.         System.out.printf("%.2f\n", p3);
  29.         //System.out.printf("%.2f", p4);
  30.  
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement