Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Renovation {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int height = Integer.parseInt(scanner.nextLine());
- int width = Integer.parseInt(scanner.nextLine());
- int nonPaintingArea = Integer.parseInt(scanner.nextLine());
- int totalArea = height * width * 4;
- int totalPaintingArea = (int)(totalArea - totalArea * nonPaintingArea / 100.0);
- String tired = "";
- int litersPaint = 0;
- while (totalPaintingArea > 0){
- tired = scanner.nextLine();
- if (tired.equals("Tired!")){
- break;
- }
- litersPaint = Integer.parseInt(tired);
- totalPaintingArea = totalPaintingArea - litersPaint;
- }
- if (tired.equals("Tired!")) {
- System.out.printf("%d quadratic m left.", totalPaintingArea);
- } else if (totalPaintingArea < 0){
- System.out.printf("All walls are painted and you have %d l paint left!", Math.abs(totalPaintingArea));
- } else if (totalPaintingArea == 0){
- System.out.println("All walls are painted! Great job, Pesho!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement