Академический Документы
Профессиональный Документы
Культура Документы
Course Details
Code : KK30303
Name : Programming Languages
Lecturer : Dr. Jason Teo (SKTM, Block A, 1st Floor, Deputy Dean’s Room)
Based on your first assignment, you should now have a good idea of how an imperative
language differs from an object-oriented language in terms of its programming
paradigm and constructs. In this second assignment, you are now required to program a
simple application using an imperative language as well as an object-oriented language
that are both new to you. The objective of this assignment is to teach you how to learn
and program in a new language on your own based on your understanding of the
features and paradigm of the programming language. A list of free
compilers/interpreters can be found at:
http://www.thefreecountry.com/compilers/index.shtml
IMPORTANT!!
1. your source codes and executable programs in one CD-R placed in separate
directories named Question1 and Question2 for each of the questions;
2. a hardcopy printout of your source codes and screenshots of your final outputs.
a) State the name of your chosen language, the reasons why you chose this
particular language and list down the link from where you downloaded the
compiler/interpreter.
(10 marks)
b) Design the data structures and required functions to implement a bank account.
The entity “Account” must have a balance of the amount of money in the bank
account, functions to deposit and withdraw money, and a function to query the
current balance.
(10 marks)
c) Based on the bank account created in (a), design the data structures and required
functions to have a higher-level entity called “bank” which uses the bank account
created earlier. This “bank” must have two different bank account types, checking
(C) and savings (S), based on the “Account” that is described above.
(10 marks)
d) Next, implement four functions for the “Bank” entity for depositing, withdrawing,
and transferring money as well as printing out to screen the balance of the
amount of money in the related account.
(10 marks)
For the deposit or withdrawal, it indicates which account is affected. For a transfer, it
indicates the account from which the money is taken; the money is automatically
transferred to the other account.
Now using an object-oriented language of your choice, implement the same simple
application as in Question 1 but now based on an object-oriented programming
methodology. The instructions that follow are similar to the ones stated in (a) and have
been included for your easy reference and understanding.
a) State the name of your chosen language, the reasons why you chose this
particular language and list down the link from where you downloaded the
compiler/interpreter.
(10 marks)
b) Design the class and required methods to implement a bank account. The object
“Account” must have a balance of the amount of money in the bank account,
functions to deposit and withdraw money, and a function to query the current
balance.
(10 marks)
c) Based on the bank account created in (a), design the data structures and required
methods to have a higher-level object called “Bank” which uses the bank account
created earlier. This “Bank” must have two different bank account types, checking
(C) and savings (S), based on the “Account” that is described above.
(10 marks)
d) Next, implement four methods for the “Bank” entity for depositing, withdrawing,
and transferring money as well as printing out to screen the balance of the
amount of money in the related account.
(10 marks)
For the deposit or withdrawal, it indicates which account is affected. For a transfer, it
indicates the account from which the money is taken; the money is automatically
transferred to the other account.