Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E02maidenParty {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double price = Double.parseDouble(scanner.nextLine());
- double loveLetters = Double.parseDouble(scanner.nextLine());
- double roses = Double.parseDouble(scanner.nextLine());
- double key = Double.parseDouble(scanner.nextLine());
- double cartoons = Double.parseDouble(scanner.nextLine());
- double surprise = Double.parseDouble(scanner.nextLine());
- double totalNumItems = loveLetters + roses + key + cartoons + surprise;
- double loveLettersPrice = 0.60 * loveLetters;
- double rosesPrice = 7.2 * roses;
- double keyPrice = 3.60 * key;
- double cartoonPrice = 18.20 * cartoons;
- double surpricePrice = 22 * surprise;
- double totalPrice = loveLettersPrice + rosesPrice + keyPrice + cartoonPrice + surpricePrice;
- if (totalNumItems >= 25)
- {
- totalPrice = 0.65 * totalPrice;
- }
- double hosting = 0.1 * totalPrice;
- double profit = totalPrice - hosting;
- if (profit > price)
- {
- System.out.printf("Yes! %.2f lv left.", profit-price);
- }
- else
- {
- System.out.printf("Not enough money! %.2f lv needed.",price - profit);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement