public class Machine
{
boolean belly_star; //whether the machine changes the star or not
int price;
int counter;
Chappie owner;
/**
* if belly star is true, and sneetch has no star, put on a star
*
* @return true if the machine is successful, false otherwise
*/
boolean run(Sneetch s)
{
if(s.money<price)
{
return false;
}
if(s.is_starred!=belly_star)
{
s.changeStar();
s.spendMoney(price);
owner.collectMoney(price);
return true;
}
return false;
}
/**
*
* @param raise
* @return price
*/
public void priceHike(double raise)
{
price = price*(1 + raise);
}
}