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 scanner = new Scanner(System.in);
- int magnolias = Integer.parseInt(scanner.nextLine());
- int hyacinths = Integer.parseInt(scanner.nextLine());
- int roses = Integer.parseInt(scanner.nextLine());
- int cacti = Integer.parseInt(scanner.nextLine());
- double gift = Double.parseDouble(scanner.nextLine());
- double total = (magnolias * 3.25 + hyacinths * 4 + roses * 3.5 + cacti * 8) * 0.95;
- if (total >= gift){
- System.out.printf("She is left with %d leva.", (int)Math.floor(total - gift));
- } else {
- System.out.printf("She will have to borrow %d leva.", (int)Math.ceil(gift - total));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement