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 *
or

Already have an account? Sign In »

Time
4 hours 19 minutes
Difficulty
Beginner
CEU/CPE
4
Video Transcription
00:00
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
00:19
discussing a lab we did in module seven, which was the module on abstraction. And this lab was
00:25
the bank account lab.
00:27
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.
00:36
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.
00:55
And then, obviously we used encapsulation to get the customer's name and their balance.
01:00
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.
01:11
And then we had our checking class
01:14
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
01:33
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
01:48
provide the implementation of this method since we are extending the bank account class
01:53
and by overriding this method
01:57
Ah, we are using runtime polymorphism. So while the program is running, that's when this method is being
02:08
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
02:28
one is obviously for the checking account
02:30
and the other one is for the savings account.
02:34
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.
02:50
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.
03:09
And that is when the program makes decisions during
03:15
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
03:29
polymorphism.
03:30
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.
03:42
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.
03:53
And I look forward to seeing you in the final marshal of this course
Up Next