4 hours 19 minutes
hi and welcome back to part three of Abstraction Lab.
So if you remember, we left off at completing our savings account cloths. And before that, we were completing our checking account class. And these both of these classes are very similar in how they have been written up. But the only main difference or one of the main difference is is that we have
two different implementations of the display balance
method, which is an abstract method that we defined on we created in our
bank account class.
Now, my tester class, I've already written up my tester close to test out our program. And the reason I did that is because it is just a tester, a quick test to see how our program works. And that shouldn't take much for them not to write, but also go through and walk the walk you through. What I exactly that
So first I created a bank account called Checking, And then I created a bank account called Savings. Now, in my checking account,
I made a checking account for Salman with a balance of $1000 then a savings account for Gary with $2000
now If you go right down here, you can see that I'm using the deposit method on my checking account. And then right after that, I am printing out the balance, the current balance of my checking account off. So Monte's checking account
after depositing $20 then what I'm doing is I'm withdrawing $10 right away, displaying or printing my balance once again. The reason I'm doing that is to
first show you how the balance would look and the output of the balance. And then the other reason I'm doing that is to validate the deposit and withdraw Mattis methods that we created. Now I'm doing the exact same thing for the savings bank account who Gary happens to own with a balance of $2000
where I deposit $50
print the balance and then withdraw $20 print the balance.
Now, in order to see how our program works, I'm gonna go ahead and click the run button over here
and perfect. So what it has out put it here is some on your current balance in the checking account is 10 20 or $1020 some on your current balance in the checking account is 10 10 or 1000 and $10.
Now that is demonstrating how our entire program is working as well as how our deposit and with our methods are working
just to make things look a little more neat.
I'm gonna go ahead and add in a dollar sign. So let's see how that works out.
So right here. And then let's do the same for the checking account.
Um, dollar sign.
All right, so let's run our program again.
All right? Perfect. So now it is officially displaying the amounts with the correct unit.
Okay, so that is essentially our bank account program. And now going back to our video like your slides.
To summarize things up, we in this lab discussed the implementation of attraction and saw how it works and as well as so, how a person can enforce a toothy idea of abstraction by using an abstract method.
Now, I hope you enjoy the video. And, um, I hope you understood this concept and in the video electric coming up next, we're gonna be starting Marshall eight, which is on inheritance. We saw some of that when I mentioned extending classes in this lab. But we will Seymour, and we will go into more depth in the next model,
as always. Thank you very much for watching this video lecture.
And I look forward to seeing you in the next module.
Sun Certified Java Programmer
Sun Certified Java Programmer practice exam will help to prepare for the Oracle Certified Associate ...