1. This question tests your understanding of Object Oriented Programming. The follow- ing code defines the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. This question tests your understanding of Object Oriented Programming. The follow- ing code defines the start of a class to represent bank accounts: class BankAccount (object): interest rate = 0.3 def _init__(self, name, number, balance) : self.name name self.number number self.balance = balance return (a) Name the class variables and the instance variables in the given code. (5 marks) (b) Add instance methods called deposit () and withdraw () which increase and decrease the balance of the account. Make sure the withdraw() method doesn't allow the account to go into overdraft. Add a third method called add-interest () which adds interest to the balance (the interest should be the interest rate multi- plied by the current balance). (14 marks) (c) Create a subclass of BankAccount called Student Account. Every Student Account should have an overdraft limit of 1000. Write a constructor for the new class. Override the withdraw() method to make sure that students can withdraw money up to their overdraft limits. (14 marks) 1. This question tests your understanding of Object Oriented Programming. The follow- ing code defines the start of a class to represent bank accounts: class BankAccount (object): interest rate = 0.3 def _init__(self, name, number, balance) : self.name name self.number number self.balance = balance return (a) Name the class variables and the instance variables in the given code. (5 marks) (b) Add instance methods called deposit () and withdraw () which increase and decrease the balance of the account. Make sure the withdraw() method doesn't allow the account to go into overdraft. Add a third method called add-interest () which adds interest to the balance (the interest should be the interest rate multi- plied by the current balance). (14 marks) (c) Create a subclass of BankAccount called Student Account. Every Student Account should have an overdraft limit of 1000. Write a constructor for the new class. Override the withdraw() method to make sure that students can withdraw money up to their overdraft limits. (14 marks)
Expert Answer:
Answer rating: 100% (QA)
In the given code snippet there are class variables and instance variables defined within the BankAccount class Lets identify them Class Variables int... View the full answer
Related Book For
Financial accounting
ISBN: 978-0136108863
8th Edition
Authors: Walter T. Harrison, Charles T. Horngren, William Bill Thomas
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
Let z(k) denote the k-year continuously compounded zero-coupon yield for the current term structure. You are given that z(1) = 0.035, z(2) = 0.041, z(3) = 0.045, z(4) = 0.049, z(5) = 0.051, z(6) =...
-
What are the implications of Figure 21-13, given that this video graph was made at a very low cutting speed?
-
The Great Pine Forest Corporation is analyzing an expansion project with the following information: Initial investment:........................................$120,000 Depreciation...
-
A \(60-\mathrm{kg}\) ice skater stands facing a wall with his arms bent and then pushes away from the wall by straightening his arms. At the instant at which his fingers lose contact with the wall,...
-
On 31 December 20X2, the balances of Argon Enterprises Inc. s shareholders equity accounts were as follows ( all are credit balances): Capital stock......................... $ 303,000 Contributed...
-
Calculate the input-referred thermal and flicker noise of the circuit shown in Fig. 1, where the output of interest is ID3 - ID4. Consider two cases: (a) Current sources are ideal. (b) Current...
-
The equilibrium adsorption of methane on a given activated carbon was studied by Grant et al. (1962). They proposed a Langmuir-type adsorption isotherm with parameters \(q_{m}=48 \mathrm{~g}...
-
Compare the failure strength of a unidirectional alumina whisker (l f /d f = 2000) reinforced epoxy with that of unidirectional continuous alumina fiber reinforced epoxy. The average tensile strength...
-
Identify the primary drawbacks of a corporation.
-
Show the differences between organizational forms using the following criteria: (a) number of owners, (b) liability for firms debts, (c) change in ownership dissolves the firm, and (d) taxation.
-
LLC International is issuing a $2,000 par value bond that pays 8 percent annual interest and matures in 10 years. Investors are willing to pay $1,800 for the bond. Floatation costs will be 4 percent...
-
How are various leverage ratios and industry norms used in capital structure management?
-
Which shape of the yield curve is considered to be the most typical?
-
What are the disadvantages of group work and teamwork? What should the other team members do when they uncover a social loafer?
-
You are a U.S. investor who purchased British securities for 2,000 one year ago when the British pound cost U.S. $1.50. What is your total return (based on U.S. dollars) if the value of the...
-
Determine the equivalent resistance \(R_{\text {eq }}\) for the circuit shown in Figure 6.9. FIGURE 6.9 Problem 2. +O V www R ww R3
-
Determine the equivalent resistance \(R_{\text {eq }}\) for the circuit shown in Figure 6.8. FIGURE 6.8 Problem 1. W R1 ev
-
Determine the equivalent resistance \(R_{\mathrm{eq}}\) for the circuit shown in Figure 6.11. Assume that all resistors have the same resistance of \(R\). FIGURE 6.11 Problem 4. R W R3 BA w R ww
Study smarter with the SolutionInn App