Advertisement
Guest User

ex 4

a guest
Jan 28th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4. import java.lang.Math;
  5.  
  6. public class Main {
  7.  
  8. public static void main(String[] args) {
  9. Scanner in = new Scanner(System.in);
  10. double maxWeight = 0.0,
  11. weight = 0.0;
  12. System.out.println("Enter the maximum weight the box could take:"); maxWeight = in.nextDouble();
  13. System.out.println("Enter the weight of apples to be boxed:"); weight = in.nextDouble();
  14. double reqBoxes = Math.ceil(weight / maxWeight);
  15. System.out.println("You will need "+(int)reqBoxes+" in order to carry your boxes.");
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement