Advertisement
desislava_topuzakova

Untitled

Feb 28th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class ChangeTiles {
  3. public static void main(String[] args) {
  4. Scanner scanner=new Scanner(System.in);
  5. double money=Double.parseDouble(scanner.nextLine());
  6. double width=Double.parseDouble(scanner.nextLine());
  7. double lenght=Double.parseDouble(scanner.nextLine());
  8. double a=Double.parseDouble(scanner.nextLine());
  9. double h=Double.parseDouble(scanner.nextLine());
  10. double piecePrice=Double.parseDouble(scanner.nextLine());
  11. double worker=Double.parseDouble(scanner.nextLine());
  12. double area=width*lenght;
  13. double pieceArea=(a*h)/2;
  14. double needPieces=Math.ceil(area/pieceArea)+5;
  15. double sum=needPieces*piecePrice+worker;
  16. if(money>=sum){double left=money-sum;
  17. System.out.printf("%.2f",left);
  18. System.out.print(" lv left.");}
  19. else if(money<sum){double raz=sum-money;
  20. System.out.print("You'll need ");
  21. System.out.printf("%.2f",raz);
  22. System.out.print(" lv more.");}
  23.  
  24.  
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement