Advertisement
rossirm

01.Wire Net - Задача 1. Оградна мрежа

Nov 6th, 2017
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class p01 {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner scan = new Scanner(System.in);
  7.  
  8.         int length = Integer.parseInt(scan.nextLine());
  9.         int width = Integer.parseInt(scan.nextLine());
  10.         double height = Double.parseDouble(scan.nextLine());
  11.         double price = Double.parseDouble(scan.nextLine());
  12.         double weight = Double.parseDouble(scan.nextLine());
  13.  
  14.         double lengthOfNet = 2 * length + 2 * width;
  15.         double priceOfNet = lengthOfNet * price;
  16.         double area = lengthOfNet * height;
  17.         double weightOfNet = area * weight;
  18.  
  19.         System.out.printf("%.0f%n", lengthOfNet);
  20.         System.out.printf("%.2f%n", priceOfNet);
  21.         System.out.printf("%.3f", weightOfNet);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement