Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P07FlowerShop {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int numberMagnolias = Integer.parseInt(scanner.nextLine());
- int numberZumbul = Integer.parseInt(scanner.nextLine());
- int numberRose = Integer.parseInt(scanner.nextLine());
- int numberCactus = Integer.parseInt(scanner.nextLine());
- double price = Double.parseDouble(scanner.nextLine());
- double magnolias = 3.35;
- double zumbul = 4;
- double rose = 3.50;
- double cactus = 8;
- double sum =Math.floor(numberMagnolias * magnolias + numberZumbul * zumbul + numberRose * rose + numberCactus * cactus);
- // sum = sum - (sum * 0.05);
- double tax = sum * 0.05; // данъци
- double profit = sum - tax; //печалба
- double lackPrice = Math.floor(Math.abs(profit - price)); //недостигнали пари
- double remainingPrice = Math.ceil(Math.abs(price - profit));
- if(price >= sum)
- {
- System.out.printf("She will have to borrow %.0f leva." , remainingPrice);
- }else{
- System.out.printf("She is left with %.0f leva." , lackPrice-1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement