Sunteți pe pagina 1din 8

1.

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.......");
}
}

S-ar putea să vă placă și