Advertisement
Spocoman

Bracelet Stand

Sep 2nd, 2024
526
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double dayCash = Double.parseDouble(scanner.nextLine()),
  7.                 dayProfit = Double.parseDouble(scanner.nextLine()),
  8.                 cost = Double.parseDouble(scanner.nextLine()),
  9.                 giftPrice = Double.parseDouble(scanner.nextLine()),
  10.                 total = (dayCash + dayProfit) * 5 - cost;
  11.  
  12.         if (total >= giftPrice) {
  13.             System.out.printf("Profit: %.2f BGN, the gift has been purchased.", total);
  14.         } else {
  15.             System.out.printf("Insufficient money: %.2f BGN.", giftPrice - total);
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement