Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Tile_Change {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- double money = Double.parseDouble(console.nextLine());
- double a = Double.parseDouble(console.nextLine());
- double b = Double.parseDouble(console.nextLine());
- double at = Double.parseDouble(console.nextLine());
- double h = Double.parseDouble(console.nextLine());
- double tilePrice = Double.parseDouble(console.nextLine());
- double workPrice = Double.parseDouble(console.nextLine());
- double areaRoom = a * b;
- double areaTile = at * h / 2;
- double tilesNeeded = Math.round((areaRoom / areaTile)) + 5;
- double moneyNeeded = tilesNeeded * tilePrice + workPrice;
- if (money >= moneyNeeded) {
- money = money - moneyNeeded;
- System.out.printf("%.02f lv left.", money);
- }
- else {
- money = moneyNeeded - money;
- System.out.printf("You'll need %.02f lv more.", money);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement