Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine());
- double width = Double.parseDouble(scanner.nextLine());
- double length = Double.parseDouble(scanner.nextLine());
- double a = Double.parseDouble(scanner.nextLine());
- double h = Double.parseDouble(scanner.nextLine());
- double pricePerTiles = Double.parseDouble(scanner.nextLine());
- double labourPrice = Double.parseDouble(scanner.nextLine());
- double squareMeters = width * length;
- double tilesSquareMeters = a * h / 2;
- double neededTiles = Math.ceil((squareMeters / tilesSquareMeters) + 5);
- double totalSum = (neededTiles * pricePerTiles) + labourPrice;
- if (totalSum <= budget) {
- System.out.printf("%.2f lv left.", budget - totalSum);
- } else {
- System.out.printf("You'll need %.2f lv more.", totalSum - budget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement