课程: Java Object-Oriented Programming
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Challenge: Banking application
(bright upbeat music) - [Instructor] Let's practice using encapsulation. In this challenge, you'll put your encapsulation skills to the test by modifying a Java program to use this object oriented principle. We'll start off with a bank account class. It has two attributes, owner and balance. Your job is to add behavior to this program so that the owner and balance attributes can be encapsulated in the bank account class while still being accessible to other classes indirectly. Specifically you should add a withdrawal method as well as the deposit method. You might also add a few getters to retrieve the balance or the owner of the account. In order to create a new bank account instance, you'll also need to add a constructor to the class. Once you've set up your bank account class, create a main class that creates a bank account. Withdraw a certain amount from the bank account and then print out the resulting balance to the…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
(已锁定)
What is encapsulation?2 分钟 16 秒
-
(已锁定)
Discovering access modifiers2 分钟 35 秒
-
(已锁定)
Implementing encapsulation with access modifiers4 分钟 20 秒
-
(已锁定)
Exploring encapsulation in Java string class3 分钟 37 秒
-
(已锁定)
Challenge: Banking application1 分钟 14 秒
-
(已锁定)
Solution: Banking application4 分钟 29 秒
-
(已锁定)
-
-
-
-