Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Toys_Wharehouse {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Enter the price of the excursion: ");
- double excursionPrice = keyboard.nextDouble();
- System.out.print("Number of puzzles: ");
- int countPuzzles = keyboard.nextInt();
- System.out.print("Number of dolls: ");
- int countDolls = keyboard.nextInt();
- System.out.print("Number of teddybears: ");
- int countTeddyBears = keyboard.nextInt();
- System.out.print("Number of trucks: ");
- int countTrucks = keyboard.nextInt();
- System.out.print("Number of minions: ");
- int countMinions = keyboard.nextInt();
- double profitPuzzles = countPuzzles * 2.60;
- double profitDoll = countDolls * 3.00;
- double profitTeddyBears = countTeddyBears * 4.10;
- double profitMinions = countMinions * 8.20;
- double profitTrucks = countTrucks * 2.00;
- double totalCount = countPuzzles + countDolls + countTeddyBears + countMinions + countTrucks;
- double totalProfit = profitPuzzles + profitDoll + profitTeddyBears + profitMinions + profitTrucks;
- if (totalCount >= 50) {
- totalCount = totalCount - (totalCount * 0.25);
- }
- totalProfit = totalProfit - (totalProfit * 0.1);
- if (totalProfit >= excursionPrice) {
- System.out.printf("Yes, you have excess of %.2f BGN", totalProfit - excursionPrice);
- } else {
- System.out.printf("Sorry, You lack %.2f BGN", excursionPrice - totalProfit);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement