/* 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
{
{
// your code goes here - эмулятор кофе-машины
System .
out .
println ( "Кофе-Машина" ) ;
int moneyAmount = 120 ;
// цены напитков
int espressoPrice = 80 ;
int capuccinoPrice = 150 ;
int milkPrice = 60 ;
int waterPrice = 20 ;
boolean canBuyAnything = false ;
System .
out .
println ( "Введите количество вносимых денег" ) ; Scanner myScanner
= new Scanner
( System .
in ) ; moneyAmount = myScanner.nextInt ( ) ;
System .
out .
printf ( "Внесено: %d \n " , moneyAmount
) ;
if ( moneyAmount >= espressoPrice) {
System .
out .
println ( "Вы можете купить эспрессо" ) ; canBuyAnything = true ;
}
if ( moneyAmount >= capuccinoPrice) {
System .
out .
println ( "Вы можете купить капучино" ) ; canBuyAnything = true ;
}
if ( moneyAmount >= milkPrice) {
System .
out .
println ( "Вы можете купить молоко" ) ; canBuyAnything = true ;
}
if ( moneyAmount >= waterPrice) {
System .
out .
println ( "Вы можете купить воду" ) ; canBuyAnything = true ;
}
if ( canBuyAnything == false ) {
System .
out .
println ( "Недостаточно средств" ) ;
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCQkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlICAtINGN0LzRg9C70Y/RgtC+0YAg0LrQvtGE0LUt0LzQsNG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