Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Lutenica {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double totalTomato = Double.parseDouble(scanner.nextLine());
- int boxes = Integer.parseInt(scanner.nextLine());
- int jars = Integer.parseInt(scanner.nextLine());
- double totalLutenica = 0;
- double jar = 0;
- double box = 0;
- double leftBoxes = 0;
- double leftJars = 0;
- totalLutenica = totalTomato / 5;
- jar = totalLutenica / 0.535;
- box = jar / jars;
- if (box > boxes){
- leftBoxes = box - boxes;
- leftJars = jar - (boxes * jars);
- System.out.printf("Total lutenica: %.0f kilograms.%n", Math.floor(totalLutenica));
- System.out.printf("%.0f boxes left.%n", Math.floor(leftBoxes));
- System.out.printf("%.0f jars left.%n", Math.floor(leftJars));
- }else if (box < boxes){
- leftBoxes = boxes - box;
- leftJars = (boxes * jars) - jar;
- System.out.printf("Total lutenica: %.0f kilograms.%n", Math.floor(totalLutenica));
- System.out.printf("%.0f more boxes needed.%n", Math.floor(leftBoxes));
- System.out.printf("%.0f more jars needed.%n", Math.floor(leftJars));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement