/* 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 ( "Кофе-машина" ) ; //Ввод суммы ====================================
Scanner scanner
= new Scanner
( System .
in ) ; System .
out .
println ( "Внесите сумму" ) ; int moneyAmount = scanner.nextInt ( ) ;
scanner.close ( ) ;
//=====================================
int espressoPrice = 80 ;
int milkPrice = 50 ;
int capuccinoPrice = 150 ;
int waterPrice = 20 ;
//=====================================
boolean canBuyAnything = false ;
if ( moneyAmount >= espressoPrice) {
System .
out .
println ( "Вы можете купить еспрессо" ) ; canBuyAnything = true ;
}
if ( moneyAmount >= milkPrice) {
System .
out .
println ( "Вы можете купить молоко" ) ; canBuyAnything = true ;
}
if ( moneyAmount >= capuccinoPrice) {
System .
out .
println ( "Вы можете купить Капучино" ) ; canBuyAnything = true ;
}
if ( moneyAmount >= waterPrice) {
System .
out .
println ( "Вы можете купить воду" ) ; canBuyAnything = true ;
}
if ( canBuyAnything == false ) {
System .
out .
println ( "Недостаточно средств. Учите Джаву идите работать" ) ; }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCQlTeXN0ZW0ub3V0LnByaW50bG4oItCa0L7RhNC1LdC80LDRiNC40L3QsCIpOwoJCS8v0JLQstC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