Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ChangeTiles {
- public static void main(String[] args) {
- Scanner scanner=new Scanner(System.in);
- double money=Double.parseDouble(scanner.nextLine());
- double width=Double.parseDouble(scanner.nextLine());
- double lenght=Double.parseDouble(scanner.nextLine());
- double a=Double.parseDouble(scanner.nextLine());
- double h=Double.parseDouble(scanner.nextLine());
- double piecePrice=Double.parseDouble(scanner.nextLine());
- double worker=Double.parseDouble(scanner.nextLine());
- double area=width*lenght;
- double pieceArea=(a*h)/2;
- double needPieces=Math.ceil(area/pieceArea)+5;
- double sum=needPieces*piecePrice+worker;
- if(money>=sum){double left=money-sum;
- System.out.printf("%.2f",left);
- System.out.print(" lv left.");}
- else if(money<sum){double raz=sum-money;
- System.out.print("You'll need ");
- System.out.printf("%.2f",raz);
- System.out.print(" lv more.");}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement