Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- import java.lang.Math;
- public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- double maxWeight = 0.0,
- weight = 0.0;
- System.out.println("Enter the maximum weight the box could take:"); maxWeight = in.nextDouble();
- System.out.println("Enter the weight of apples to be boxed:"); weight = in.nextDouble();
- double reqBoxes = Math.ceil(weight / maxWeight);
- System.out.println("You will need "+(int)reqBoxes+" in order to carry your boxes.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement