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 magnolii = Integer.parseInt(scanner.nextLine());
- int zumbuli = Integer.parseInt(scanner.nextLine());
- int roses = Integer.parseInt(scanner.nextLine());
- int kaktus = Integer.parseInt(scanner.nextLine());
- double priceGift = Double.parseDouble(scanner.nextLine());
- double priceFlowers = (magnolii * 3.25 + zumbuli * 4 + roses * 3.5 + kaktus * 8) * 0.95;
- if (priceFlowers > priceGift){
- double ostatak = priceFlowers - priceGift;
- System.out.println("She is left with " + Math.floor(ostatak) + " leva.");
- }
- else {
- double needed = priceGift - priceFlowers;
- System.out.println("She will have to borrow " + Math.ceil(needed)+ " leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement