Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class toyShop {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- double tripP = Double.parseDouble(input.nextLine());
- int puzzles = Integer.parseInt(input.nextLine());
- int dolls = Integer.parseInt(input.nextLine());
- int bears = Integer.parseInt(input.nextLine());
- int minions = Integer.parseInt(input.nextLine());
- int trucks = Integer.parseInt(input.nextLine());
- double puzzleP = 2.60;
- double talkingDollP = 3.0;
- double teddybear = 4.10;
- double minion = 8.20;
- double truck = 2.0;
- double left = 0.0;
- double bill1 = (puzzleP * puzzles) + (talkingDollP * dolls) + (teddybear * bears) + (minion * minions) + (truck * trucks);
- double totalToys = puzzles + dolls + bears + minions + trucks;
- if(totalToys >= 50){
- bill1 = bill1 - (bill1 * 0.25);
- }
- double rent = bill1 * 0.1;
- double finalIncome = bill1 - rent;
- if(finalIncome >= tripP){
- left = finalIncome - tripP;
- System.out.printf("Yes! %.2f lv left.",left);
- }else{
- left = tripP - finalIncome;
- System.out.printf("Not enough money! %.2f lv needed.",left);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement