Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class FlowerShop {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double magnoliaPrice = 3.25;
- int hyacinthsPrice = 4;
- double rosesPrice = 3.5;
- int cactusPrice = 8;
- int magnoliaCount = Integer.parseInt(scan.nextLine());
- int hyacinthsCount = Integer.parseInt(scan.nextLine());
- int rosesCount = Integer.parseInt(scan.nextLine());
- int cactusCount = Integer.parseInt(scan.nextLine());
- double giftPrice = Integer.parseInt(scan.nextLine());
- double totalPrice = magnoliaCount * magnoliaPrice + hyacinthsCount * hyacinthsPrice + rosesCount * rosesPrice +
- cactusCount * cactusPrice;
- double taxes = totalPrice - (totalPrice * 0.05);
- if (totalPrice <= giftPrice) {
- System.out.printf("She is left with %.2f leva.", Math.floor(totalPrice - taxes));
- } else {
- System.out.printf("She will have to borrow %.2f leva.", Math.floor(giftPrice - taxes));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement