Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ProgrammingBasics2;
- 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 aGift = Double.parseDouble(scanner.nextLine());
- double sum = (magnolias*3.25)+(hyacinths*4.00)+(roses*3.50)+(cacti*8.00);
- double taxes = sum*0.05;
- double result = sum-taxes;
- if(aGift <= result){
- double diff = Math.abs(aGift-result);
- System.out.printf("She is left with %.0f leva.",Math.floor(diff));
- }else{
- double diff1=Math.abs(aGift-result);
- System.out.printf("She will have to borrow %.0f leva.",Math.ceil(diff1));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement