Advertisement
kristiyanasimeonova

Untitled

Oct 12th, 2019
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Renovation {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int height = Integer.parseInt(scanner.nextLine());
  7. int weight = Integer.parseInt(scanner.nextLine());
  8. int percent = Integer.parseInt(scanner.nextLine());
  9. int room = 4 * height * weight;
  10. double realPaintNeed = Math.ceil(room - (percent/100.0*room));
  11. double done = 0;
  12. double paintLeft =0;
  13. while (done <= realPaintNeed){
  14. String paint = scanner.nextLine();
  15. if (paint.equals("Tired!")){
  16. break;
  17. }
  18. done += Integer.parseInt(paint);
  19. }
  20. if (done > realPaintNeed){
  21. paintLeft = (done - realPaintNeed);
  22. System.out.printf("All walls are painted and you have %.0f l paint left!",paintLeft);
  23.  
  24. }else if (done == realPaintNeed){
  25. System.out.println("All walls are painted! Great job, Pesho!");
  26. }else {
  27. double left = Math.ceil(realPaintNeed - done);
  28. System.out.printf("%.0f quadratic m left.",left);
  29.  
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement