Computer Science (CSCI) Department
College of Engineering, Computer Science, & Technology (ECST)

JETT Workshops
Java Basics

Fall 2004

 

More on Methods
(Example code and figures from Computing Concepts with Java Essentials, 3rd edition, by Cay Horstmann.
Visit www.wiley.com/college/horstmann for information on the current edition of this excellent text.)

Exercise - add more methods to the BankAccount project

  • edit the BankAccount class
    • add a new instance variable for an interest rate
    • add a new constructor that will accept the balance and the interest rate
    • add a method to set a new interest rate
    • add a method to calculate interest on the current balance and add it to the balance
  • edit the BankAccountTest class
    • create a variety of BankAccount objects
    • call methods on them
    • print out results or use the debugger