Professional Documents
Culture Documents
ID
IT
Assignment 4
Actor System
1.Click on register button
3.Enter name,address,salary,KYC,
Actor System
Activity Diagram:
Sequence Diagram:
Code :
1. Entity
import java.util.ArrayList;
import java.util.Scanner; // Import the Scanner class
}
2. Interface
import java.util.Scanner; // Import the Scanner class
}
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;
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.
ACTOR SYSTEM
ACTOR SYSTEM
2.6. Post Condition : User gets logged into the system if the entered
credentials were correct
- Complexity : Medium.
Activity Diagram:
Sequence Diagram:
State Machine Diagram:
Class Diagram:
Code :
1.Entity
import java.util.Scanner; // Import the Scanner class
2.Interface
//package loanSystem.UI;
}
public String getUname(){
return this.uname;
}
public String getPass(){
return this.pass;
}
3.Controller
public class LoginController{
EntityLogin el;
LoginInterface li;
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.......");
}
}
Actor System
Actor System
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
2.Interface
import java.util.Scanner; // Import the Scanner class
//System.out.println(types);
}
public String getType(){
return this.type;
}
public String getAmt(){
return this.amt;
}
public String getRepaySch(){
return this.repaysch;
}
public String getConf(){
return this.confirm;
}
3.Controller
public class AFLController {
EntityApplyLoan ea;
AFLInterface ai;
4.System
public class ApplyLoanSystem {
ac.setEntityLogin(ea);
ac.setLoginInterface(ai);
ea.addTypes();
System.out.println(ea.types);
ac.ai.readForm();
System.out.println(result);
}
}
6. Calculate EMI
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
6 Calculates EMI
Actor System
3.1 User inputs invalid loan Display invalid loan type or period, redirect
type or period to point 3 in basic flow
Activity Diagram:
Sequence Diagram:
State Machine Diagram: Not Applicable
Class Diagram:
Code :-
1.Entity
import java.util.Scanner; // Import the Scanner class
2.Interface
import java.util.Scanner; // Import the Scanner class
CalculateEMIInterface() {
sc = new Scanner(System.in); // Create a Scanner object
}
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));
}
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;
}
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.
Actor System
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.
Activity Diagram:
Sequence Diagram:
State Machine Diagram : Not Applicable
Class Diagram:
Code :-
1. Entity
import java.util.Scanner;
2. Interface
import java.util.Scanner;
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;
if (validatePayment == true)
return true;
else
return false;
}
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
8.1 Description: This use case helps the user to download and view customer
reports
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.
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
1.Interface
import java.util.*;
import java.io.*;
class CustomerReports_Interface{
CustomerReports_Interface(){
email = br.readLine();
Entity_User.addDummy();
if(!m.containsKey(email)){
return;
User u=(User)m.get(email);
ArrayList<Integer> temp=u.getList();
System.out.println("ID: "+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{
ArrayList<PaymentDetails> list =
Entity_PaymentDetails.retrievePayments(loan_id);
for(PaymentDetails pd : list){
System.out.println("---------------------------");
3.Entity
import java.util.*;
import java.io.*;
import java.text.SimpleDateFormat;
class Entity_PaymentDetails{
set.add(pd);
addDummyDetails();
for(PaymentDetails p : set){
if(p.getLoanID()==loan_id){
list.add(p);
return list;
addPayment(pdobj);
addPayment(pdobj1);
addPayment(pdobj2);
4.System
import java.util.*;
import java.io.*;
class CustomerReports_System{
cri.getDetails();
}
}
9. Part Payment of 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.
Actor System
1.Clicks on Part Payment
option.
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.
Codes:
1. Entity
import java.util.Scanner; // Import the Scanner class
2.Interface
3.Controller
4.System
public class PartPayController{
EntityPartPay epp;
PartPayInterface ppi;
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;
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();
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
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 {
else {
return false;
}
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 {
2. Interface
import java.util.Scanner;
else {
return false;
}
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 {
3. Controller
public class CloseLoanController {
CloseLoanEntity cle;
CloseLoanInterface cli;
public void setCloseLoanEntity( CloseLoanEntity closeLoanEntity) {
this.cle = 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.3 Pre-Condition:
The employee of bank should be logged in and should have proper
internet connection.
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.
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.
Activity Diagram:
Sequence Diagram:
Class Diagram:
Codes:
1.Entity
int CurrentIR;
int newIR;
public boolean StorenewIR(int NewIR){
if (NewIR)
{ currentIR = newIR;
return true;
}
else
return false;
}
if(ec.StorenewIR)
System.out.println("New Interst rate has been Updated
Sucessfully");
else
System.out.println("error in updating interest rate");
}
}
2.Interafce
3.Controller
}
public boolean validateIR(int newIR)
{
if(newIR>100)
return false;
else
return true;
}
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: