We create two classes: Account and Savings. The Account class has private fields Account number and balance, and the constructor and methods for deposit and withdrawal. The Savings class inherits from the Account class and adds an additional field: interest rate and accrueInterest() for special calculation. The constructor of the Savings class uses the constructor of the base Account class. The main method contains the Account and Savings object classes, and then the methods are called deposit, withdrawal and basic accrual. At the end, the balances of both accounts on the screen are taken out.
-
Notifications
You must be signed in to change notification settings - Fork 0
blackmonoceros/fun_with_java-tbc1
About
create
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published