/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
System.
out.
println("Кофе-машина"); boolean canBuyAnything = false;
int moneyAmount = 10;
String[] drinks
= {"капучино",
"эспрессо",
"вода",
"молоко"}; int[] prices = {150, 80, 20, 40};
for(int i = 0; i < 4; i = i + 1)
{
System.
out.
println(drinks
[i
] + "=>" + prices
[i
]); }
for( int i = 0;i < 4; i = i + 1)
{
if(moneyAmount >= prices[i])
{
System.
out.
println("Вы можете купить" + " " + drinks
[i
]); canBuyAnything = true;
}
}
if(!canBuyAnything)
{
System.
out.
println("Недостаточно средств!!!"); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN5c3RlbS5vdXQucHJpbnRsbigi0JrQvtGE0LUt0LzQsNGI0LjQvdCwIik7CgkJYm9vbGVhbiBjYW5CdXlBbnl0aGluZyA9IGZhbHNlOwoJCWludCBtb25leUFtb3VudCA9IDEwOwoJCVN0cmluZ1tdIGRyaW5rcyA9IHsi0LrQsNC/0YPRh9C40L3QviIsICLRjdGB0L/RgNC10YHRgdC+IiwgItCy0L7QtNCwIiwgItC80L7Qu9C+0LrQviJ9OwoJCWludFtdIHByaWNlcyA9IHsxNTAsIDgwLCAyMCwgNDB9OwoJCQoJCWZvcihpbnQgaSA9IDA7IGkgPCA0OyBpID0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