Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class flowerShop {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         int magnolii = Integer.parseInt(scanner.nextLine());
  8.         int zumbuli = Integer.parseInt(scanner.nextLine());
  9.         int roses = Integer.parseInt(scanner.nextLine());
  10.         int kaktus = Integer.parseInt(scanner.nextLine());
  11.         double priceGift = Double.parseDouble(scanner.nextLine());
  12.  
  13.         double priceFlowers = (magnolii * 3.25 + zumbuli * 4 + roses * 3.5 + kaktus * 8) * 0.95;
  14.         if (priceFlowers > priceGift){
  15.            double ostatak = priceFlowers - priceGift;
  16.             System.out.println("She is left with " + Math.floor(ostatak) + " leva.");
  17.         }
  18.         else {
  19.             double needed = priceGift - priceFlowers;
  20.             System.out.println("She will have to borrow " + Math.ceil(needed)+ " leva.");
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement