9.3 Bank Account Lab Review

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »

4 hours 19 minutes
Video Transcription
Hi and welcome back to the course. I hope you guys doing well. And if you remember in the last video lecture, we did a quick lab review of our math lab that we did in the module on methods, which was Marshall four. And in this lab review today, it will be
discussing a lab we did in module seven, which was the module on abstraction. And this lab was
the bank account lab.
And by the end of this lab, our goal is to understand how dynamic Polymorphism are also known as a run time for dwarfism works.
Now, at this moment, I'd like you to go ahead and switch over to intelligence they and open up the lab. We did in module seven and let's quickly go. Aah! Over it. So, in this lab, essentially, what we did is we had a general bank account class with, um, a few methods to deposit, withdraw money.
And then, obviously we used encapsulation to get the customer's name and their balance.
And we did that by making both the customer's name and balance both of these variables private, which is one of the requirements of encapsulation. If you want to use encapsulation.
And then we had our checking class
in our chicken class, we had our constructor and in our savings class we also had our constructor. And in our tester class we had a bunch of test code. But the main port that I'd like to go over that is related specifically to dynamic or runtime polymorphism. Is this
over ridden display balance method. So what we did here is we had we dis find an abstract method called display balance and because of abstraction, we will We were forced to
provide the implementation of this method since we are extending the bank account class
and by overriding this method
Ah, we are using runtime polymorphism. So while the program is running, that's when this method is being
executed. Since we are overriding that specific method and the same is happening over here with a savings account class and the only difference between this implementation and this implementation of the over it and display balance method is that
one is obviously for the checking account
and the other one is for the savings account.
And then in our tester, we could see how our program works by creating a new checking and savings account and then obviously using the deposit withdrawal method and then printing out the results of our actions here.
All right, so if we go back to our slides in this video lecture we discussed run time or dynamic polymorphism by reviewing the bank account lab and essentially all you have to know is that dynamic polymorphism or run timepoint dwarfism is achieved through method overriding.
And that is when the program makes decisions during
run time. Whereas, as we discussed in our previous lab review, a method overloading is used for compile time polymorphism or also known as static
All right, so coming up next, we have our final module of this course and I'm very excited, and I'm happy that we have gotten to that point.
So thank you very much for watching. And if you have any questions at all, feel free to connect with me. V. Ellington and I would be more than happy to answer any of your questions.
And I look forward to seeing you in the final marshal of this course
Up Next