Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double dayCash = Double.parseDouble(scanner.nextLine()),
- dayProfit = Double.parseDouble(scanner.nextLine()),
- cost = Double.parseDouble(scanner.nextLine()),
- giftPrice = Double.parseDouble(scanner.nextLine()),
- total = (dayCash + dayProfit) * 5 - cost;
- if (total >= giftPrice) {
- System.out.printf("Profit: %.2f BGN, the gift has been purchased.", total);
- } else {
- System.out.printf("Insufficient money: %.2f BGN.", giftPrice - total);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement