skipter

FlowerShop - Java Basics

Apr 29th, 2017
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FOX {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner input = new Scanner(System.in);
  7.  
  8.         double magnolia = 3.25;
  9.         double zombiuli = 4.00;
  10.         double rosses = 3.50;
  11.         double cactuses = 8.00;
  12.  
  13.         int magnoliAsk = Integer.parseInt(input.nextLine());
  14.         int zombiuliAsk = Integer.parseInt(input.nextLine());
  15.         int rossesAsk = Integer.parseInt(input.nextLine());
  16.         int cactusesAsk = Integer.parseInt(input.nextLine());
  17.         double presentPrice = Double.parseDouble(input.nextLine());
  18.  
  19.         double totalAsk = (magnoliAsk * magnolia) + (zombiuli * zombiuliAsk) + (rosses * rossesAsk) + (cactuses * cactusesAsk);
  20.  
  21.         double dds = totalAsk - (totalAsk * 0.05);
  22.         double danuci = totalAsk - dds;
  23.         double clearMoney = totalAsk - danuci;
  24.  
  25.         double diff = (presentPrice - clearMoney);
  26.         double check = 0;
  27.  
  28.         if (clearMoney < presentPrice) {
  29.             System.out.printf("She will have to borrow %.0f leva.", (Math.ceil(diff)));
  30.         } else {
  31.             check = diff;
  32.             System.out.printf("She is left with %.0f leva.", Math.abs(Math.ceil(check)));
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment