Assignment 1: Activity 9 Practical

Assignment 1:

Activity 9

Practical

19 Consider the BankAccount example introduced earlier. To demonstrate Inheritance we would define a few more account types that would have similar features to the Savings account hence could derive from it.

  1. Create class called OverDraftAccount7 and CurrentAccount7 account inheriting from BankAccount1. Assume that the these two new account types have the same features of the savings account. Let us further specify that the only difference is that interest in Current Account interest is 1%, ODAccount is 0.5% if the balance is positive and minus 10% if the balance is negative. Whereas the savings accounts have a 5% interest all other features remain the same.
  2. Write a driver program called BankApp7 to test the following:
  3. Instantiate the two derived class objects and observe the interest behaviour.
  4. Try a dynamic binding to the parent type and observe the effect.

iii. Observe the inheritance behaviour for late binding and record your observation

What new concepts have we learnt in Question Seven c?

➢ A simple IS-A relation. That is Foreign Currency account is-a BankAccount … and more.

20 Repeat question 5 a,b with virtual methods and override methods. Notice the difference in late binding behaviour.

What new concepts have we learnt in Question Eight?

➢ The polymorphic effect of the Account class.

Assignment 2:

Activity 07

11) Write code to create a JPanel with 4 JCheckBox GUI components and two JLabels for output, one that says “Current cost is” and the other that outputs the computed cost based on which of the food items has been selected.

12) Provide code to generate the following JFrame. Each lettered item is a JButton. Hint: Create several JPanels, each one having two or more JButtons and taken up a portion of the JFrame.

13) Provide code to generate the following JFrame. Each lettered item is a JButton. Hint: Create several JPanels, each one having two or more JButtons and taken up a portion of the JFrame.

14) Provide code to generate the following JFrame. Each lettered item is a JButton. Hint: Create several JPanels, each one having two or more JButtons and taken up a portion of the JFrame.

 

Last Updated on February 11, 2019 by EssayPro