FACULTY OF INFORMATION AND COMMUNICATION
TECHNOLOGIES
SUMMER 2023
FINAL EXAMINATION
COURSE TITLE: JAVA 1
COURSE CODE: ICT
INSTRUCTOR: Serh Jeff
DUE DATE: 06/08/2023
DURATION: TWO WEEKS
Java Case Study – I
Framework for Bank
Instructions
Answer all Questions
In each method provided include comments describing set method in your ide
Follow the procedure provided in each abstract class to generate the code
The names and declarations of your methods, class, constructor, fields, Access, type
and properties should be as provided in the tables below, anything otherwise will be
penalized.
Student are required to understand the application before submission and presentation
Question 01
Design a simple framework for Bank Application to represent Saving Accounts
and Current Accounts in java.
Use the framework to design application for MoneyMoney Bank.
Objectives
To understand the concept of framework in application development.
Areas of application for Abstract classes, abstract methods etc.
Polymorphism and its uses,
Encapsulation and its uses
Final fields and Lazy Initialization
Getter and Setter methods
Objects in java
Lazy Binding of methods
Page 1 of 3
<<ABSTRACT>>
Framework BankAcc
-int accNo
-int accNm
<<ABSTRACT>> -int accBal
BankFactory
+void withdraw(float)
SavingAcc getNewSavingAccount() +void deposite(float)
CurrentAcc getNewCurrentAccount() +String toString()
<<ABSTRACT>> <<ABSTRACT>>
SavingAcc CurrentAcc
+boolean isSalary float creditLimit
+void withdraw(float) +void withdraw(float)
+String toString() +String toString()
MMBankFactory MMSavingAcc MMCurrentAcc
SavingAcc getNewSavingAccount()
+void withdraw(float) +void withdraw(float)
CurrentAcc getNewCurrentAccount()
+String toString() +String toString()
Application part for Bank
Design following class structures for framework…
1. Abstract BankAcc: An abstract class to represent a bank account.
Fields Access Type Property
accNo private int Read Only
accNm private String Read-Write
accBal private float Read Only
Constructors Access Parameters
public AccNo, accNm, accBal
Methods Access Return Type Parameters Particulars
withdraw public void float
deposite public void float
toString public String Overridden
2. Abstract SavingAcc extends BankAcc: An abstract class to represent specific
case of Saving Account. It extends BankAcc. The overridden withdraw method
of the class must not allow withdrawal below minimum balance in the account.
Fields Access Type Property Particulars
Page 2 of 3
isSalaried private boolean Read Only
MINBAL private float Read Only static final
Constructors Access Parameters
public AccNo, accNm, accBal, isSalaried
Methods Access Return Type Parameters Particulars
withdraw public void float Overridden
toString public String Overridden
3. Abstract CurrentAcc extends BankAcc: An abstract class to represent specific
case of Current Account. It extends BankAcc. The overridden withdrawal
method of the class must not allow withdrawal below sum of balance and the
credit limit for the account.
Fields Access Type Property Particulars
creditLimit private float Read Only final
Constructors Access Parameters Particulars
public AccNo, accNm, accBal, Lazy initialization
creditLimit for creditLimit.
Methods Access Return Type Parameters Particulars
withdraw public void float Overridden
toString public String Overridden
4. Abstract BankFactory: An abstract class having necessary factory methods to
instantiate new Saving or Current types of accounts.
Methods Access Return Type Parameters
getNewSavingAcc public SavingAcc AccNo, accNm, accBal, isSalaried
getNewCurrentAcc public CurrentAcc AccNo, accNm, accBal,
creditLimit
Design following class structures for application part…
5. Concrete MMSavingAcc: A concrete class representing bank specific Saving
Account. It extends SavingAcc.
Fields Access Type Property Particulars
MINBAL private float Read Only static final
Constructors Access Parameters
public AccNo, accNm, accBal, isSalaried
Methods Access Return Type Parameters Particulars
withdraw public void float Overridden
toString public String Overridden
Page 3 of 3
6. Concrete MMCurrentAcc: A concrete class representing bank specific Current
Account. It extends CurrentAcc.
Constructors Access Parameters Particulars
public AccNo, accNm, accBal, Lazy initialization
creditLimit for creditLimit.
Methods Access Return Type Parameters Particulars
withdraw public void float Overridden
toString public String Overridden
7. Concrete MMBankFactory: A concrete class having complete implementation of
necessary factory methods to instantiate MMSavingAcc and MMCurrentAcc. It
extends BankFactory.
Methods Access Return Type Parameters
getNewSavingAcc public MMSavingAcc AccNo, accNm, accBal,
isSalaried
getNewCurrentAcc public MMCurrentAcc AccNo, accNm, accBal,
creditLimit
8. The Entry point for application part: Design an entry point for the application to
test working of a framework.
a. Assign instance of MMBankFactory to BankFactory reference.
b. Instantiate MMSavingAcc and refer it through reference SavingAcc.
c. Instantiate MMCurrentAcc and refer it through reference CurrentAcc.
d. Invoke withdraw() method.
e. Invoke toString() method.
Question 02
SmartBuy is a leading mobile shop in the town. After buying a product, the customer
needs to provide a few personal details for the invoice to be generated.
You being their software consultant have been approached to develop software to retrieve
the personal details of the customers, which will help them to generate the invoice faster.
Component Specification: Customer
Type (class) Attribute method Responsibilities
Customer String customerName Include the
getters and
setters methods
for all attributes
long contactNumber
String emailId
Int age
In the Main class, create an object for the Customer class.
Page 4 of 3
Get the details as shown in the sample input and assign the value for its attributes using
the setters.
Display the details as shown in the sample output using the getters method. All classes
and methods should be public, Attributes should be private.
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the
input given by the user and the rest of the text represents the output.
Ensure to follow the object oriented specifications provided in the question.
Ensure to provide the names for classes, attributes and methods as specified in the
question. Adhere to the code template, if provided.
Sample Input 1:
Enter the Name:
john
Enter the ContactNumber:
9874561230
Enter the EmailId:
john@gmail.com
Enter the Age:
32
Sample Output 1:
Name: john
ContactNumber:9874561230
EmailId:john@gmail.com
Age:32
Good Luck
Page 5 of 3