Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class u2 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int magnoliasNumber = Integer.parseInt(scanner.nextLine());
- int hyacinthusNumber = Integer.parseInt(scanner.nextLine());
- int rosesNumber = Integer.parseInt(scanner.nextLine());
- int cactusNumber = Integer.parseInt(scanner.nextLine());
- int giftPrice = Integer.parseInt(scanner.nextLine());
- double magnolias = magnoliasNumber * 3.25;
- double hyacinthus = hyacinthusNumber * 4.00;
- double roses = rosesNumber * 3.50;
- double cactus = cactusNumber * 8.00;
- double totalProfitWithoutTaxes = magnolias + hyacinthus + roses + cactus;
- double totalProfit = (totalProfitWithoutTaxes -(totalProfitWithoutTaxes*0.05));
- double neededMoney = Math.abs(totalProfit - giftPrice);
- if (totalProfit < giftPrice) {
- System.out.printf("She will have to borrow " + Math.ceil(neededMoney) + " leva.");
- } else {
- System.out.println("She is left with " + Math.floor(neededMoney) + " leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement