You are on page 1of 91

NAME

ID

Software Analysis and Design

IT

Assignment 4

Loan Management System


LOAN MANAGEMENT SYSTEM

USE CASE DIAGRAM:


Following are the Use case Specifications and respective diagrams for each use
case:
1. Registration of Customer
Use case Specifications:
1.1. Description :- Register to the System.
1.2. Actor :- Customer.
1.3. Precondition :- None.
1.4. Basic Flow Of Event :-

Actor System
1.Click on register button

2. Display Registration Screen

3.Enter name,address,salary,KYC,

Phone no,email id,password.


4.Search data in database.
5.Stores data in database.
6.Redirect to Home page.

1.5.Alternate Flow Of Event :

Actor System

3.1 Invalid Data Entry 3.1.1 Error message takes it back to


Step 3.
4.1 Email Address Exist 4.1.1 Error message user already exist
and exit.

1.6.Post Condition :- Account Created.


1.7.Special Cases :- Response Time is Less than 2s.

1.8.Frequency of Usage :- High Frequency and hence thoroughly tested and


implemented.

Activity Diagram:
Sequence Diagram:

State Machine Diagram:


Class Diagram:

Code :
1. Entity
import java.util.ArrayList;
import java.util.Scanner; // Import the Scanner class

public class EntityRegistration{

public ArrayList<String> u = new ArrayList<String>();


public ArrayList<String> p = new ArrayList<String>();
public ArrayList<String> e = new ArrayList<String>();
// private String uname, pass, email;

public void store (String uName, String Pass, String Email)


{
u.add(uName);
p.add(Pass);
e.add(Email);

}
2. Interface
import java.util.Scanner; // Import the Scanner class

public class RegistrationInterface{


private String uname;
private String pass;
private String email;

public void getDetails(){


Scanner myObj = new Scanner(System.in); // Create a Scanner
object
System.out.println("Enter User Name");
this.uname= myObj.nextLine(); // Read user input
System.out.println("Enter Email");
this.email=myObj.nextLine(); // Read user input
System.out.println("Enter Password");
this.pass=myObj.nextLine(); // Read user input

}
public String getUname(){
return this.uname;
}
public String getEmail(){
return this.email;
}
public String getPass(){
return this.pass;
}
public void displayMessage()
{
System.out.println("Registered successfully");
}

3. Controller
public class RegistrationController{
EntityRegistration er;
RegistrationInterface ri;

public void setEntityRegistration( EntityRegistration entityRegistration){


this.er=entityRegistration;
}
public void setRegistrationInterface(RegistrationInterface
registrationInterface){
this.ri=registrationInterface;
}

public boolean authenticate(String u,String e)


{
return !(er.u.contains(u)||er.e.contains(e));
}
}

4. System
public class RegistrationSystem{
public static void main(String[] args){
RegistrationInterface ri = new RegistrationInterface();
RegistrationController rc = new RegistrationController();
EntityRegistration er = new EntityRegistration();

rc.setEntityRegistration(er);
rc.setRegistrationInterface(ri);

rc.ri.getDetails();
boolean result= rc.authenticate(rc.ri.getUname(),rc.ri.getEmail());

if (result)
{rc.er.store(rc.ri.getUname(), rc.ri.getPass(),rc.ri.getEmail());

rc.ri.displayMessage();
}
else System.out.println("User exists");
}

2. Login
Use case Specifications:

2.1. Description : This use case let’s the user log into the their account.

2.2. Actor : User

2.3. Pre Condition : Internet Connection should be available and the


user must have registered before.
2.4. Basic Flow of Execution:

ACTOR SYSTEM

1.Actor clicks on the Login


button

2.System displays Login


screen to actor.

3.Actor enters username and


password and clicks ‘OK’

4.System searches given


username in database and
retrieve actor’s password.

5.System compares the


password and authenticates
the actor.

6.System displays ‘Login


Successful’ message and
navigate to actor’s page.

2.5. Alternate Flow of Execution:

ACTOR SYSTEM

3.1 Actor enters invalid 3.1.1 System shows error


username/password. and redirects to step 3 in the
basic flow (Three times and
exits use case
4.1 Username not available
in database.

4.1.1 System displays error


‘Invalid User’ ,exits use
case.

5.1 Invalid Password 5.1.1 System displays error


‘Invalid Password’ and
redirect to step 3 and exits
the usecase.

2.6. Post Condition : User gets logged into the system if the entered
credentials were correct

2.7. Special Specifications :

- Response Time : Should not be less than 3 seconds.

- Throughput : Concurrent 100 transactions required.

2.8. Other Specifications :

-Frequency Of Usage is high so the component needs to be developed


properly and tested with 100% accuracy.

- Complexity : Medium.

Activity Diagram:
Sequence Diagram:
State Machine Diagram:

Class Diagram:
Code :
1.Entity
import java.util.Scanner; // Import the Scanner class

public class EntityLogin{


public String getUserDetails(String uName){
if (uName.equals("Mahesh"))
return "Mahesh123";
else
return "pass";
}
public static void main(String[] args){
EntityLogin el = new EntityLogin();
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Enter User Name");
String uname= myObj.nextLine(); // Read user input

System.out.println("User Password: "+ el.getUserDetails(uname));


}
}

2.Interface
//package loanSystem.UI;

import java.util.Scanner; // Import the Scanner class

public class LoginInterface{


private String uname;
private String pass;

public void readForm(){


Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Enter User Name");
this.uname= myObj.nextLine(); // Read user input
System.out.println("Enter Password");
this.pass=myObj.nextLine(); // Read user input

}
public String getUname(){
return this.uname;
}
public String getPass(){
return this.pass;
}

public static void main(String[] args){


LoginInterface li = new LoginInterface();
li.readForm();
System.out.println("User Name: "+ li.getUname());
System.out.println("Password: "+ li.getPass());
}
}

3.Controller
public class LoginController{
EntityLogin el;
LoginInterface li;

public boolean authenticateUser(String password, String pass ){


if (password.equals(pass))
return true;
else
return false;
}

public void setEntityLogin( EntityLogin entityLogin){


this.el=entityLogin;
}
public void setLoginInterface(LoginInterface loginInterface){
this.li=loginInterface;
}

4.System
class LoginSystem{
public static void main(String[] args){
LoginInterface li = new LoginInterface();
LoginController lc = new LoginController();
EntityLogin el = new EntityLogin();

lc.setEntityLogin(el);
lc.setLoginInterface(li);

lc.li.readForm();
boolean result = lc.authenticateUser(lc.li.getPass(),
lc.el.getUserDetails(lc.li.getUname()));

if (result)
System.out.println("Login Succcessful !!!! ");
else
System.out.println("Login Failed.......");
}
}

3.Apply for Loan


Use case Specifications:

3.1 Description – Actor can apply for loan.

3.2 Actors – Customer

3.3 Pre-Condition – Customer must be successfully logged into the system.


3.4 Basic Flow of interaction–

Actor System

1 Actor will click on apply for


loan

2 System displays apply for loan page


and requests type of loan

3 Selects type of loan. Clicks


next.

4 Processes input and requests amount


of loan

5 Inputs amount. Clicks next.

6 Processes input and displays the


various repayment schedule options

7 Selects feasible repayment


schedule and clicks next

8 Processes input and displays all


entered details and request user/
actor for confirmation

9 Clicks on confirm button

System displays confirmation


message “Applied for loan”
3.5 Alternate or Exceptional flow –

Actor System

1 User clicks on edit button System redirects to step (2) basic


flow

3.6 Post-condition – Redirects to Upload documents

3.7 Special Conditions –

Response time must be less than 3 seconds.

Concurrent 100 processes can be performed

3.8 Other Specifications –

Frequency of usage: Moderate

Complexity: Easy

Activity Diagram:
Sequence Diagram:
State Machine Diagram : Not Applicable

Class Diagram:
Code:

1.Entity
import java.util.ArrayList;
//import java.util.Scanner; // Import the Scanner class

public class EntityApplyLoan {


ArrayList<String> types= new ArrayList<String>();

//ctype: customer selected type, camt: customer selected amount,


crsc: cust. selected repayment schedule
ArrayList<String> ctype= new ArrayList<String>();
ArrayList<String> camt= new ArrayList<String>();
ArrayList<String> crsc= new ArrayList<String>();

public void addTypes()


{
types.add("Home loan");
types.add("Gold loan");
types.add("Personal loan");
types.add("Business loan");
types.add("Education loan");
types.add("Vehicle loan");
}

public void storedetails(String type, String amt, String repaysch)


{
ctype.add(type);
camt.add(amt);
crsc.add(repaysch);
}

public String getUserDetails(String confirm){


if (confirm.equals("yes"))
return "success";
else
return "enter options again";
}
}

2.Interface
import java.util.Scanner; // Import the Scanner class

public class AFLInterface {


private String type;
private String amt;
private String repaysch;
private String confirm;

public void readForm(){


Scanner myObj = new Scanner(System.in); // Create a Scanner object

//System.out.println(types);

System.out.println("Enter Type of Loan");


this.type=myObj.nextLine();

System.out.println("Enter Amount of Loan");


this.amt=myObj.nextLine();

System.out.println("Enter Repayment Schedule of Loan");


this.repaysch=myObj.nextLine();

System.out.println("Do you want to confirm the loan? please write


yes/no");
this.confirm=myObj.nextLine();

}
public String getType(){
return this.type;
}
public String getAmt(){
return this.amt;
}
public String getRepaySch(){
return this.repaysch;
}
public String getConf(){
return this.confirm;
}

public static void main(String[] args){


AFLInterface ai = new AFLInterface();
ai.readForm();
System.out.println("Type of Loan: "+ ai.getType());
System.out.println("Amount of Loan: "+ ai.getAmt());
System.out.println("Repayment schedule of Loan: "+
ai.getRepaySch());
}
}

3.Controller
public class AFLController {
EntityApplyLoan ea;
AFLInterface ai;

public void setEntityLogin( EntityApplyLoan entityApplyLoan){


this.ea=entityApplyLoan;
}
public void setLoginInterface(AFLInterface applyInterface){
this.ai=applyInterface;
}

4.System
public class ApplyLoanSystem {

public static void main(String[] args){


AFLInterface ai = new AFLInterface();
AFLController ac = new AFLController();
EntityApplyLoan ea = new EntityApplyLoan();

ac.setEntityLogin(ea);
ac.setLoginInterface(ai);
ea.addTypes();
System.out.println(ea.types);
ac.ai.readForm();

String result = ac.ea.getUserDetails(ac.ai.getConf());


ac.ea.storedetails(ac.ai.getType(), ac.ai.getAmt(), ac.ai.getRepaySch());

System.out.println(result);
}
}

6. Calculate EMI

Use case Specifications:

6.1 Description – For calculation of EMI according to loan type and period
6.2 Actors – Customer
6.3 Pre-Condition – Customer must be logged in
6.4 Basic Flow of interaction–
Actor System
1 Clicks on calculate EMI

2 Generates input screen for loan type


and period

3 User inputs loan type and period

4 Checks validity of input

5 Fetches interest rates from database

6 Calculates EMI

7 Displays calculated EMI

6.5 Alternate or Exceptional flow –

Actor System

3.1 User inputs invalid loan Display invalid loan type or period, redirect
type or period to point 3 in basic flow

6.6 Post-condition – Redirects to apply for loan

6.7 Special Conditions –


Response time must be less than 2 seconds.

6.8 Other Specifications –


Frequency of usage: Moderate
Complexity: Easy

Activity Diagram:
Sequence Diagram:
State Machine Diagram: Not Applicable

Class Diagram:
Code :-
1.Entity
import java.util.Scanner; // Import the Scanner class

public class CalculateEMIEntity {


private String type;
private int period;

public String getType() {


return type;
}

public void setType(String type) {


this.type = type;
}

public int getPeriod() {


return period;
}

public void setPeriod(int period) {


this.period = period;
}

public float getInterestRate() {


if (type.toLowerCase().equalsIgnoreCase("personal")) {
return (float) 7.5;
} else if (type.equalsIgnoreCase("home")) {
return (float) 8;
} else {
return (float) 7.75;
}
}

public static void main(String[] args) {


CalculateEMIEntity ce = new CalculateEMIEntity();
ce.setType("personal");
ce.setPeriod(24);
System.out.println("Loan details: ");
System.out.println("Loan type: " + ce.getType());
System.out.println("Loan period: " + Integer.toString(ce.getPeriod()));
System.out.println("Loan interest rate: " +
Float.toString(ce.getInterestRate()));
}
}

2.Interface
import java.util.Scanner; // Import the Scanner class

public class CalculateEMIInterface {


private Scanner sc;

CalculateEMIInterface() {
sc = new Scanner(System.in); // Create a Scanner object
}

void takeInput(CalculateEMIEntity loanDetails) {


System.out.print("Enter loan type: ");
loanDetails.setType(sc.nextLine());
System.out.print("Enter loan period (in months): ");
loanDetails.setPeriod(sc.nextInt());
}

void showInvalid() {
System.out.println("Invalid loan details provided");
}

float takeAmountInput() {
System.out.print("Enter amount: ");
return sc.nextFloat();
}
void displayEMI(float emi) {
System.out.println("Monthly EMI: " + Float.toString(emi));
}

public static void main(String[] args) {


CalculateEMIInterface ci = new CalculateEMIInterface();
CalculateEMIEntity loanDetails = new CalculateEMIEntity();
ci.takeInput(loanDetails);
System.out.println("Loan Type: " + loanDetails.getType());
System.out.println("Loan Period: " + loanDetails.getPeriod());

float amount = ci.takeAmountInput();


System.out.println("Amount: " + Float.toString(amount));
}
}

3. Controller
public class CalculateEMIController {
boolean validate(String type, int period) {
if (period < 6 || period > 36) {
return false;
}
if (type.toLowerCase() == "mobile") {
return false;
}
return true;
}

float fetchInterest(CalculateEMIEntity loanDetails) {


return loanDetails.getInterestRate();
}

float calculateEMI(CalculateEMIEntity loanDetails, float amount) {


float interestRate = fetchInterest(loanDetails);
int period = loanDetails.getPeriod();
return (float) (amount * (100.0 + interestRate)) / ((float) period * 100);
}
}

4. System
class CalculateEMISystem{
public static void main(String[] args){
CalculateEMIInterface ci = new CalculateEMIInterface();
CalculateEMIController cc = new CalculateEMIController();
CalculateEMIEntity loanDetails = new CalculateEMIEntity();

ci.takeInput(loanDetails);
boolean valid = cc.validate(loanDetails.getType(),
loanDetails.getPeriod());

if(!valid) {
ci.showInvalid();
} else {
float amount = ci.takeAmountInput();
float emi = cc.calculateEMI(loanDetails, amount);
ci.displayEMI(emi);
}
}
}

7. EMI PAYMENT
Use case Specifications:

7.1 Description – For paying monthly EMI of loan taken by ECS mode or by
depositing a post-dated cheque.

7.2 Actors – Customer


7.3 Pre-Condition – EMI should already have been calculated and customer
should be logged in.

7.4 Basic Flow of interaction–

Actor System

1 User clicks on EMI payment


button.
2 Displays payment due(EMI + penalty,
if any) and input screen for selecting
between “ECS mode” and “post-dated
cheque”
3 User chooses the type of mode.

4 System navigates user to another


website.
5 User clicks on pay EMI button.

6 Displays message: Payment done


successfully.

7.5 Alternate or Exceptional flow –


Actor System

4.1 Poor network Display poor connectivity, redirect to point 2


connectivity during in Basic Flow
payment
5.1 EMI Payment is not done System calculates penalty and displays
within 15 days. message: Pay EMI and penalty within next 10
days

7.6 Post-condition – Payment done is recorded.

7.7 Special Conditions – If by doing the EMI payment, the complete loan is paid
off, close the loan account and give back the mortgage documents.

7.8 Other Specifications –


Frequency of usage: High
Complexity: Hard as payment completion is a difficult process.

Activity Diagram:
Sequence Diagram:
State Machine Diagram : Not Applicable

Class Diagram:
Code :-

1. Entity
import java.util.Scanner;

public class EntityBank{


public boolean validatePayment(double amount){
System.out.println("Amount of Rs. "+amount+" received by the
bank.");
return true;
}
public static void main(String[] args){
EntityBank eb = new EntityBank();
Scanner obj = new Scanner(System.in);
System.out.println("Enter amount to be paid.");
double amount = obj.nextDouble();
System.out.println("Amount of Rs. "+amount+"is being paid");
}
}

2. Interface
import java.util.Scanner;

public class PaymentInterface{


private double amount;
public int paymentMode;
public int timeLeft;

public boolean readForm(){


Scanner obj = new Scanner(System.in);
System.out.println("Enter EMI Payment amount to be repaid");
this.amount = obj.nextDouble();
obj.nextLine();
System.out.println("Enter Payment Mode\n 1. ECS\n 2. Cheque");
this.paymentMode = obj.nextInt();
if (this.paymentMode != 1 && this.paymentMode != 2){
System.out.println("Invalid Payment Mode");
return false;
}
obj.nextLine();
System.out.println("Enter time left (in days) to make your
payment(negative if payment due date is passed)");
this.timeLeft = obj.nextInt();
return true;
}

public double getAmount(){


return this.amount;
}
public int getPaymentMode(){
return this.paymentMode;
}
public int getTimeLeft(){
return this.timeLeft;
}

public static void main(String[] args){


PaymentInterface pi = new PaymentInterface();
pi.readForm();
System.out.println("Amount being paid: "+pi.getAmount());

switch(pi.getPaymentMode()){
case 1:
System.out.println("Payment Mode: ECS ");

break;
case 2:
System.out.println("Payment Mode: Cheque");
break;
default:
System.out.println("Payment Mode: INVALID");
}
System.out.println("Time left to make Payment:
"+pi.getAmount());

}
}

3. Controller
public class PaymentController{
EntityBank eb;
PaymentInterface pi;

public boolean makePayment(double amount, int paymentMode, int


timeLeft, boolean validatePayment){
if(timeLeft < 0){
if (timeLeft > -15){
System.out.println("The payment is late (within 15 days), be sure
to pay the EMI due WITH the PENALTY within the next 10 days
otherwise payment through portal will not be done and will have to
contact the bank.");
}
else{
System.out.println("Payment cannot be done because it has been
15 days since due EMI Payment Date");
return false;
}
}
else{
switch(paymentMode){
case 1:
System.out.println("Payment is on-time and was done by ECS
mode.");
break;
case 2:
System.out.println("Payment is on-time and was done by
Cheque.");
break;
}
}

if (validatePayment == true)
return true;
else
return false;
}

public void setEntityBank(EntityBank entityBank){


this.eb = entityBank;
}
public void setPaymentInterface(PaymentInterface
paymentInterface){
this.pi = paymentInterface;
}
}

4. System
class EMIPayment{
public static void main(String[] args){
PaymentInterface pi = new PaymentInterface();
PaymentController pc = new PaymentController();
EntityBank eb = new EntityBank();

pc.setEntityBank(eb);
pc.setPaymentInterface(pi);

boolean result;
if (pc.pi.readForm()){

result = pc.makePayment(pc.pi.getAmount(),
pc.pi.getPaymentMode(), pc.pi.timeLeft,
pc.eb.validatePayment(pc.pi.getAmount()) );
}
else {
result = false;
}

if (result)
System.out.println("EMI Payment Successful !!!");
else
System.out.println("Payment Failed ........");

}
}

8. CUSTOMER REPORT

Use case Specifications:

8.1 Description: This use case helps the user to download and view customer
reports

8.2 Actors: Customer

8.3 Pre- Conditions: The user must be logged into the system and there
should be an active internet connection.
8.4 Basic flow of Interactions:

Actor System
1.User clicks on the “Get Reports”
button.
2.System displays a list of all the possible
reports that can be generated
A. Payment report
B. Income Tax Report
3.User clicks on the desired option.
4.System generates the report and
displays it on the screen with a
“Download” button.
5.User clicks on the “Download”
button.
6.System opens the file manager and asks
for the location.
7.User selects the location and clicks
on the “OK” button.
8.System downloads the file on the
computer and displays the home page.

8.5 Alternate flow of interactions:

Actor System
5.1. User clicks on the “Back” button. 5.1.1. Join step 2 in basic flow.
4.1. Database connectivity is lost
4.1.1 System will display message
“Database error occurred”.
4.1.2. System exits the use-case
8.1. Internet connectivity is lost
8.1.1 System will display message
“Internet connectivity lost”.
8.1.2. Join step 4 in basic flow
8.2. There is insufficient storage.
8.2.1 System will display message
“Insufficient storage”.
8.2.2. Join step 4 in basic flow

8.6 Post Conditions: The user has successfully downloaded or viewed


reports

8.7 Special Conditions:


1. The system should respond to the user within 2 seconds of the request.
2. At the same time 100 users can access the use case simultaneously.

8.8 Other Specifications:


● Frequency: Moderate
● Complexity: Simple
Activity Diagram:
Sequence Diagram:

State Machine Diagram:


Class Diagram:
Codes:-

1.Interface

import java.util.*;

import java.io.*;

class CustomerReports_Interface{

private String email;

private int loan_id;

private CustomerReports_Controller crc;

CustomerReports_Interface(){

crc = new CustomerReports_Controller();

public void getDetails() throws IOException{

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter your email: ");

email = br.readLine();

Entity_User.addDummy();

Entity_User user= new Entity_User();


HashMap m=user.getmap();

if(!m.containsKey(email)){

System.out.println("You are not registered! ");

return;

User u=(User)m.get(email);

ArrayList<Integer> temp=u.getList();

System.out.println("Following are your loan details: ");

for(int id: temp){

System.out.println("ID: "+id);

System.out.println("Enter loan id: ");

loan_id = Integer.parseInt(br.readLine());

crc.getReports(loan_id);

}}

2.Controller

import java.util.*;
import java.io.*;

import java.text.SimpleDateFormat;

class CustomerReports_Controller{

public void getReports(int loan_id){

ArrayList<PaymentDetails> list =
Entity_PaymentDetails.retrievePayments(loan_id);

SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy


HH:mm:ss");

for(PaymentDetails pd : list){

System.out.println("Date : " + formatter.format(pd.getDate()));

System.out.println("Amount : " + pd.getAmount());

System.out.println("Payment type : " + pd.getType());

System.out.println("---------------------------");

3.Entity

import java.util.*;

import java.io.*;
import java.text.SimpleDateFormat;

class Entity_PaymentDetails{

private static HashSet<PaymentDetails> set = new HashSet<>();

public static void addPayment(PaymentDetails pd){

set.add(pd);

public static ArrayList<PaymentDetails> retrievePayments(int loan_id){

addDummyDetails();

ArrayList<PaymentDetails> list = new ArrayList<>();

for(PaymentDetails p : set){

if(p.getLoanID()==loan_id){

list.add(p);

return list;

public static void addDummyDetails(){


Date date = new Date();

PaymentDetails pdobj = new PaymentDetails(date ,(long)100,"emi",1);

PaymentDetails pdobj1 = new PaymentDetails(date,(long)200,"emi",1);

PaymentDetails pdobj2 = new PaymentDetails(date,(long)300,"emi",1);

addPayment(pdobj);

addPayment(pdobj1);

addPayment(pdobj2);

4.System

import java.util.*;

import java.io.*;

class CustomerReports_System{

public static void main(String[] args) throws IOException{

CustomerReports_Interface cri = new CustomerReports_Interface();

cri.getDetails();

}
}
9. Part Payment of Loan

Use case Specifications:

9.1 Use-Case Description:


The use case is used for part payment of the applicant’s loan.

9.2 Actors:
Applicant

9.3 Pre-condition
1. The loan should be approved.
2. The user must be logged in.
3. User must have an unpaid loan.

9.4 Basic Flow of Interaction:

Actor System
1.Clicks on Part Payment
option.

2.Displays Part Payment page.


3. Selects amount to be
paid
4.Check if applicant has sufficient bank balance
to pay given amount.

5.The transaction is successfully carried out.


6.Display success message along with
outstanding loan amount.

7. Click on ‘Done’ button

9.5 Alternative or Exception Flow of Interaction:

4.1 User does not have sufficient balance to pay the amount:
4.1.1 Display Insufficient Balance message, go back to previous screen.
4.2 Amount selected is greater than the outstanding loan amount:
4.2.1 Display Amount Invalid message and go back to previous screen.
5.1 Transaction failure:
5.1.2 Display Transaction Failed message and go back to previous
screen.

9.6 Post Condition


1. System displays message of success or failure
2. Applicant selects between reducing EMI amount or reducing repayment
period.

9.7 Special Conditions:


1. The response time should be less than 10sec.
2. The transactions should be concurrent

9.8 Other Specification:


Complexity-Low
Frequency-Moderate
Activity Diagram:
Sequence Diagram:
State Machine Diagram:
Class Diagram:

Codes:

1. Entity
import java.util.Scanner; // Import the Scanner class

public class EntityPartPay{


public String getUserDetails(String uName){
if (uName.equals("Mahesh"))
return "Mahesh123";
else
return "pass";
}
public static void main(String[] args){
EntityPartPay epp = new EntityPartPay();
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Enter User Name");
String uname= myObj.nextLine(); // Read user input

System.out.println("User Password: "+ epp.getUserDetails(uname));


}
}

2.Interface

public class PartPayController{


EntityPartPay epp;
PartPayInterface ppi;

public boolean authenticatePayment(double amount, double out_amt,


double balance){
if(balance-amount <= 5000)
return false;
else if(amount > out_amt)
return false;
else
return true;
}
public void setEntityPartPay( EntityPartPay entityPartPay){
this.epp = entityPartPay;
}
public void setPartPayInterface(PartPayInterface partPayInterface){
this.ppi=partPayInterface;
}
}

3.Controller

public class PartPayController{


EntityPartPay epp;
PartPayInterface ppi;

public boolean authenticatePayment(double amount, double out_amt,


double balance){
if(balance-amount <= 5000)
return false;
else if(amount > out_amt)
return false;
else
return true;
}

public void setEntityPartPay( EntityPartPay entityPartPay){


this.epp = entityPartPay;
}
public void setPartPayInterface(PartPayInterface partPayInterface){
this.ppi=partPayInterface;
}
}

4.System
public class PartPayController{
EntityPartPay epp;
PartPayInterface ppi;

public boolean authenticatePayment(double amount, double out_amt,


double balance){
if(balance-amount <= 5000)
return false;
else if(amount > out_amt)
return false;
else
return true;
}

public void setEntityPartPay( EntityPartPay entityPartPay){


this.epp = entityPartPay;
}
public void setPartPayInterface(PartPayInterface partPayInterface){
this.ppi=partPayInterface;
}
}

10. Disburse Loan

Use case Specifications:

10.1 Use-Case Description:The use case is used to disburse loan to loan


applicant’s account

10.2 Actors:Bank Officer

10.3 Pre-condition:The loan should be approved

10.4 Basic Flow of Interaction:


Bank Officer System

1.Clicks on Disburse Loan 2.Displays Loan Id page

3.Enters Loan Id 4.Fetch details of


applicant and loan

5.Clicks on Proceed Loan 6.Transfers money to


loan applicant’s account

10.5 Alternative or Exception Flow of Interaction:

Bank Officer System

5.Clicks on Cancel Payment button 6.Payment process is


cancelled and is
redirected to loan ID
page

10.6 Post Condition:System displays message of success or failure

10.7 Special Conditions:The response time should be less than 10sec.

10.8 Other Specification:

Complexity-Low

Frequency-Moderate
Activity Diagram:

Sequence Diagram:
State Machine Diagram:
Class Diagram:

Codes:

1. Entity
import java.util.HashMap;
public class LoanDetailsEntity
{
//hashmap as mapping between loadID and status (loan details)
// true if loan is checked and sanctioned
HashMap<Integer,Boolean> loanDetails ;

LoanDetailsEntity()
{
loanDetails = new HashMap<Integer,Boolean>()
{
{
put(1,true);
put(2,false);
put(3,true);
put(4,true);
put(5,true);
}
};
}
//get loan details
private void getDataFromDB()
{
//code for getting data from the database
//into the hashmap

2. Interface

import java.util.Scanner;

public class DisburseLoanInterface


{
public void print(String val)
{
System.out.println(val);
}
public int inputLoanID()
{
Scanner sc = new Scanner(System.in);
int inp = sc.nextInt();
return inp;
}
public char inputOption()
{
Scanner sc = new Scanner(System.in);
String val = sc.next();
return val.charAt(0);
}
public boolean getDetails(int loadID)
{
DisburseLoanController controller = new DisburseLoanController();
return controller.getLoanDetails(loadID);
}

3. Controller

import java.util.HashMap;
public class DisburseLoanController
{
// private int loanID;
public boolean getLoanDetails(int loanID)
{
LoanDetailsEntity entity = new LoanDetailsEntity();
HashMap<Integer,Boolean> map = entity.loanDetails;
if(map.containsKey(loanID))
return map.get(loanID);
else
return false;
}
public String displayLoanDetails(int loanID,boolean loanDetails)
{
if(loanDetails)
return "Loan for ID :"+loanID+" has been sanctioned\n";
else
return "Loan for ID :"+loanID+" is not sanctioned\n";
}
public boolean transferMoney(int loadID)
{
boolean response = false;
System.out.println("Loan amount for ID "+loadID+" is transferred");
response= true;
//bank amount transfer code
// bank api connection
return response;
}
}

4. System

class DisburseLoanSystem
{
// static int loanID;
public static void main(String[] args)
{
DisburseLoanInterface interface_ = new DisburseLoanInterface();
DisburseLoanController controller = new DisburseLoanController();

interface_.print("Enter Loan ID : ");


int loanID = interface_.inputLoanID();
boolean response = interface_.getDetails(loanID);

if(response)
{
interface_.print(controller.displayLoanDetails(loanID,response));
interface_.print("Do you want to proceed [Y/N] : ");
if(interface_.inputOption()== 'Y' )
{
boolean status = controller.transferMoney(loanID);
interface_.print( status?"\nStatus from Bank:successful":"\nStatus
from Bank:failed" );
}
else interface_.print("\nLoan amount is not transferred");
}
else System.out.println(controller.displayLoanDetails(loanID,response));
}
}
11. Close Loan

Use case Specifications:


11.1 Description – It is used for closing an Open Loan.

11. 2 Actors – Admin

11.3 Pre-Condition – The admin should be logged in to the system.

11.4 Basic Flow of Interaction–


Actor System
1. Actor clicks on Close Loan 2. System displays the user details
button. form.
3. Actor enters the user details and 4.1 System checks the details.
clicks on Check details.
4.2 System checks if all EMIs are
paid.
4.3 System closes the loan.

11.5 Alternate or Exceptional Flow –


Actor System

Invalid user. System redirects to the user login


page.
Improper user details entered. System redirects to the user details
page.
All EMIs are not paid. System prints this message and
redirects to the homepage.

11.6 Post-Condition – The loan is closed and the homepage is displayed to the
actor.

11.7 Special Conditions – The response time for the System to check details and
EMI should not exceed 3 minutes.

11.8 Other Specifications – The loan holder (user) should contact the admin for
closing the loan. Without the intervention of the admin, an user cannot close
his/her loan.
Activity Diagram:

Sequence Diagram:
State Machine Diagram:

Class Diagram:
Codes:

1. Entity
import java.util.Scanner;
public class CloseLoanEntity {

public boolean verifyUserDetails(String userName, String accountID){

if (userName.equals("Mahesh") && accountID.equals("ABC442211"))


{
return true;
}

else {
return false;
}

public static void main(String args[]) {

CloseLoanEntity cle = new CloseLoanEntity();


Scanner scanner = new Scanner(System.in);

System.out.println("Enter User Name");


String userName= scanner.nextLine();

System.out.println("Enter Account ID");


String accountID = scanner.nextLine();

if (verifyUserDetails(userName, accountID)) {

if (paidEMI) {
System.out.println("Loan can be now closed as per wish");
}

else {
System.out.println("EMIs have not been paid.");
}
}

else {

System.out.println("Wrong details entered, please try again!");

2. Interface
import java.util.Scanner;

public class CloseLoanEntity {

public boolean verifyUserDetails(String userName, String accountID){

if (userName.equals("Mahesh") && accountID.equals("ABC442211"))


{
return true;
}

else {
return false;
}

public static void main(String args[]) {

CloseLoanEntity cle = new CloseLoanEntity();


Scanner scanner = new Scanner(System.in);
System.out.println("Enter User Name");
String userName= scanner.nextLine();

System.out.println("Enter Account ID");


String accountID = scanner.nextLine();

if (verifyUserDetails(userName, accountID)) {

if (paidEMI) {
System.out.println("Loan can be now closed as per wish");
}

else {
System.out.println("EMIs have not been paid.");
}

else {

System.out.println("Wrong details entered, please try again!");

3. Controller
public class CloseLoanController {

CloseLoanEntity cle;
CloseLoanInterface cli;
public void setCloseLoanEntity( CloseLoanEntity closeLoanEntity) {
this.cle = closeLoanEntity;
}

public void setCloseLoanInterface(CloseLoanInterface


closeLoanInterface) {
this.cli = closeLoanInterface;
}

public boolean verifyEMIpaid(CloseLoanInterface cli) {


return cli.paidEMI;
}
}
4. System
class CloseLoanSystem {
public static void main(String args[]) {

CloseLoanInterface cli = new CloseLoanInterface();


CloseLoanController clc = new CloseLoanController();
CloseLoanEntity cle = new CloseLoanEntity();

clc.setCloseLoanEntity(cle);
clc.setCloseLoanInterface(cli);

clc.cli.enterAmount();
boolean result = clc.verifyEMIPaid(cli);

if (result == true) {
System.out.println("Loan has been closed!!");
}
else {
System.out.println("Failed to Close Loan");
}
}
}
12. Change Interest Rate
Use case Specifications:

12.1. Use Case Description :


The interest rate on our loan can change due to some regulatory
changes in government policy or bank policy. Then, the bank can use this
option to change interest rate. The bank employee will enter the new interest
rate, if that interest rate is valid, then it will be updated in the database and
displayed to user. Otherwise, the error message will be displayed.

12.2 Actor : Bank employee.

12.3 Pre-Condition:
The employee of bank should be logged in and should have proper
internet connection.

12.4 Basic Flow of Interaction

Actor System
1) The user clicks on change interest
rate button ( CIR button ) .
2) System will display the Change
interest rate screen.
3) The user will enter new interest rate
and clicks on the submit button.
4) System validates the new interest rate
given by the user. If the new interest rate
is valid, then it is stored in the database.
5) System will display the new updated
interest rate to the user.

12.5 Alternate Flow of Condition:

Actor System
1) The user enters invalid new interest
rate in the change interest rate column or
leaves that column empty.
2) System redirects the user to step 4.3
of the basic flow.
1) Database connectivity is lost.
1.1)System will display message
“Database error occurred.”
1.2)System redirects to step 4.3 of basic
flow.
1) Internet connectivity is lost.
1.1) System will display message
“internet connectivity is lost.
1.2) System redirects to step 4.3 of basic
flow.

12.6 Post-Condition:
The user has successfully changed the interest rate.

12.7 Special Condition :


Number of concurrent users : Only single user must access the use case at
that time.

12.8 Others Specification: none.

Activity Diagram:
Sequence Diagram:

State Machine Diagram:

Class Diagram:
Codes:

1.Entity

import java.util.Scanner; // Import the Scanner class

public class EntityCIR{

int CurrentIR;
int newIR;
public boolean StorenewIR(int NewIR){
if (NewIR)
{ currentIR = newIR;
return true;
}
else
return false;
}

public static void main(String[] args){


EntityCIR ec = new EntityCIR();
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Enter New Interest rate to be updated");
int newIR = myObj.nextInt(); // Read user input

if(ec.StorenewIR)
System.out.println("New Interst rate has been Updated
Sucessfully");
else
System.out.println("error in updating interest rate");

}
}

2.Interafce

public class CirController{


EntityCIR ec;
CirInterface ci;

public void DisplayCurrentIR( int currentIR ){

System.out.println("The Current Interest Rate is:" : currentIR);


}
public boolean validateIR(int newIR)
{
if(newIR>100)
return false;
else
return true;
}

public void setEntityCIR( EntityCIR entityCIR){


this.ec=entityCIR;
}
public void setCIRInterface(CirInterface cirInterface){
this.ci=cirInterface;
}

3.Controller

public class CirController{


EntityCIR ec;
CirInterface ci;

public void DisplayCurrentIR( int currentIR ){

System.out.println("The Current Interest Rate is:" : currentIR);

}
public boolean validateIR(int newIR)
{
if(newIR>100)
return false;
else
return true;
}

public void setEntityCIR( EntityCIR entityCIR){


this.ec=entityCIR;
}
public void setCIRInterface(CirInterface cirInterface){
this.ci=cirInterface;
}

4.System

class CirSystem{
public static void main(String[] args){
CirInterface ci = new CirInterface();
CirController cc = new CirController();
EntityCIR ec = new EntityCir();

cc.setEntityCIR(ec);
cc.setCirInterface(ci);

cc.ci.getCurrentRate();
cc.ci.SetnewRate();
boolean result = ec.StorenewIR(cc.ci.getnewRate());

if (result)
System.out.println("Change of interest rate successful !!!! ");
else
System.out.println("Change of interest rate failed .......");
}
}
PACKAGING AND LAYERING DIAGRAM:

You might also like