7.4 Bank Account Part 3

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 part three of Abstraction Lab.
00:04
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
00:22
two different implementations of the display balance
00:25
method, which is an abstract method that we defined on we created in our
00:32
bank account class.
00:34
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
00:52
So first I created a bank account called Checking, And then I created a bank account called Savings. Now, in my checking account,
00:59
I made a checking account for Salman with a balance of $1000 then a savings account for Gary with $2000
01:10
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
01:23
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
01:36
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
01:56
where I deposit $50
01:57
print the balance and then withdraw $20 print the balance.
02:01
Now, in order to see how our program works, I'm gonna go ahead and click the run button over here
02:08
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.
02:23
Now that is demonstrating how our entire program is working as well as how our deposit and with our methods are working
02:30
just to make things look a little more neat.
02:36
I'm gonna go ahead and add in a dollar sign. So let's see how that works out.
02:43
So right here. And then let's do the same for the checking account.
02:47
Um, dollar sign.
02:53
All right, so let's run our program again.
02:55
All right? Perfect. So now it is officially displaying the amounts with the correct unit.
03:02
Okay, so that is essentially our bank account program. And now going back to our video like your slides.
03:12
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.
03:30
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,
03:47
as always. Thank you very much for watching this video lecture.
03:51
And I look forward to seeing you in the next module.
Up Next