class UserAccount {
public static void main
(String[] args
){
UserAccount Vasia = new UserAccount("Vasia Pupkin",5000);
Vasia.payout(5001);
Vasia.payment(102);
Vasia.getbalance();
}
public double money;
public UserAccount
(String name,
double money
){ this.name = name;
this.money = money;
}
public double payout(double countMoney){
this.money -= countMoney;
if (this.money <= 0){
System.
out.
println("Not enough money"); this.money += countMoney;
return this.money;
}
else {
return this.money;
}
}
public double payment(double countMoney){
this.money = this.money + countMoney;
return this.money;
}
public void getbalance(){
System.
out.
println(name
+ " have " + money
+ " dollars"); }
}
Y2xhc3MgVXNlckFjY291bnQgewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncyl7CgkJCgkJVXNlckFjY291bnQgVmFzaWEgPSBuZXcgVXNlckFjY291bnQoIlZhc2lhIFB1cGtpbiIsNTAwMCk7CgkJVmFzaWEucGF5b3V0KDUwMDEpOwoJCVZhc2lhLnBheW1lbnQoMTAyKTsKCQlWYXNpYS5nZXRiYWxhbmNlKCk7CgkJCgl9CglwdWJsaWMgU3RyaW5nIG5hbWU7CglwdWJsaWMgZG91YmxlIG1vbmV5OwoJCglwdWJsaWMgVXNlckFjY291bnQoU3RyaW5nIG5hbWUsIGRvdWJsZSBtb25leSl7CgkJdGhpcy5uYW1lID0gbmFtZTsKCQl0aGlzLm1vbmV5ID0gbW9uZXk7Cgl9CgoJcHVibGljIGRvdWJsZSBwYXlvdXQoZG91YmxlIGNvdW50TW9uZXkpewoJCXRoaXMubW9uZXkgLT0gY291bnRNb25leTsKCQlpZiAodGhpcy5tb25leSA8PSAwKXsKCQkJU3lzdGVtLm91dC5wcmludGxuKCJOb3QgZW5vdWdoIG1vbmV5Iik7CgkJCXRoaXMubW9uZXkgKz0gY291bnRNb25leTsKCQkJcmV0dXJuIHRoaXMubW9uZXk7CgkJCX0KCQkKCQllbHNlIHsKCQkJcmV0dXJuIHRoaXMubW9uZXk7CgkJCX0KCX0KCXB1YmxpYyBkb3VibGUgcGF5bWVudChkb3VibGUgY291bnRNb25leSl7CgkJdGhpcy5tb25leSA9IHRoaXMubW9uZXkgKyBjb3VudE1vbmV5OwoJCXJldHVybiB0aGlzLm1vbmV5OwoJfQoJcHVibGljIHZvaWQgZ2V0YmFsYW5jZSgpewoJCVN5c3RlbS5vdXQucHJpbnRsbihuYW1lICsgIiBoYXZlICIgKyBtb25leSArICIgZG9sbGFycyIpOwoJfQp9CQ==