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

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 balance is increased if the expression is false. You will obviously have to rewrite the condition to make things happen this way around
 Rewrite the if-else statement so that the method still behaves correctly

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!