I have a Machine class but I don't know how to create a constructor which takes owner, price, and belly_star parameters.
main class
//create machines: Machine star_on = new Machine(fix_it_up, generator.nextInt(10), true); Machine star_off = new Machine(fix_it_up, generator.nextInt(10), false);
Machine class
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); } }