yovkovbpfps

EXAM 01.WIRE NET

Apr 27th, 2019
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 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. }
Add Comment
Please, Sign In to add comment