/* package whatever; // don't place package name! */
import java.util.* ;
import java.lang.* ;
import java.io.* ;
import java.util .Scanner . *;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
System .
out .
println ( "Кофе-машина" ) ;
Scanner in
= new Scanner
( System .
in ) ; System .
out .
print ( "Количество денег " ) ; int moneyAmount = in.nextInt ( ) ;
System .
out .
printf ( " %d \n " , moneyAmount
) ; in.close ( ) ;
int espressoPrice = 60 ;
int americanoPrice = 80 ;
int lattePrice = 150 ;
int waterPrice = 20 ;
int milkPrice = 40 ;
boolean canBuyAnything = false ;
if ( moneyAmount >= espressoPrice)
{
System .
out .
println ( "Вы можете купить эспрессо (1) " ) ; canBuyAnything = true ;
}
if ( moneyAmount >= americanoPrice)
{
System .
out .
println ( "Вы можете купить американо (2) " ) ; canBuyAnything = true ;
}
if ( moneyAmount >= lattePrice)
{
System .
out .
println ( "Вы можете купить латте (3) " ) ; canBuyAnything = true ;
}
if ( moneyAmount >= waterPrice)
{
System .
out .
println ( "Вы можете купить воду (4) " ) ; canBuyAnything = true ;
}
if ( moneyAmount >= milkPrice)
{
System .
out .
println ( "Вы можете купить молоко (5) " ) ; canBuyAnything = true ;
}
if ( canBuyAnything == false ) {
System .
out .
println ( "Недостаточно средств!" ) ; }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwuU2Nhbm5lci4gKjsKCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9u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