Modify class Account (Fig. 7.8) to provide a method called withdraw that withdraws money from an Account.

Question:

Modify class Account (Fig. 7.8) to provide a method called withdraw that withdraws money from an Account. Ensure that the withdrawal amount does not exceed the Account’s balance. If it does, the balance should be left unchanged and the method should print a message indicating "Withdrawal amount exceeded account balance." Modify class AccountTest (Fig. 7.9) to test method withdraw.

Fig. 7.8I // Fig. 7.8: Account.java 2 // Account class with a double instance variable balance and a constructor //

Fig. 7.9J // Fig. 7.9: AccountTest.java 2 // Inputting and outputting floating-point numbers with Account objects. 3

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: