Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class main {
- public static void main(String[] args) {
- System.out.println("Кофе - машина");
- int moneyAmount = 10;
- int[] drinkPrices = {150, 80, 20};
- String[] drinkNames = {"капучино", "эспрессо", "воду"};
- boolean canBuyAnything = false;
- for(int i = 0; i < 3; i++) {
- if(moneyAmount >= drinkPrices[i]){
- System.out.println("Вы можете купить " + drinkNames[i]);
- canBuyAnything = true;
- }
- }
- if(!canBuyAnything) {
- System.out.println("Недостаточно средств :( учите Java и зарабатывайте много :)");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement