Question: Rewrite the if-else statement so that the method still behaves correctly but the error message is printed if the Boolean expression is true but the
ile Undo Cut Copy Paste Find. Close Receive an amount of money from a customer. * Check that the amount ia senaible. public void insertMoney(int amount) if (amount > 0) balance -balance +amount: else System.out.printin ("Use a positive amount rather than: "+ amount): * Print a ticket if enough money has been inserted, and * reduce the current balance by the ticket price. Print *an error message if more money is required. public void printTicket o it (balance >m price) (
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
