1
LIST OF EXPERIMENTS
Sl.No. Name of Experiment
Draw standard UML diagrams using an UML modelling tool for a given
case study and map design to code and implement a 3 layered
architecture. Test the developed code and validate whether the SRS is
satisfied.
1. Identify a software system that needs to be developed.
2. Document the Software Requirements Specification (SRS) for the
identified system.
3. Identify use cases and develop the Use Case model.
4. Identify the conceptual classes and develop a Domain Model and also
derive a Class Diagram from that.
5. Using the identified scenarios, find the interaction between objects and
represent them using UML Sequence and Collaboration Diagrams
6. Draw relevant State Chart and Activity Diagrams for the same system.
7. Implement the system as per the detailed design
Test the software system for all the scenarios identified as per the use
8. case diagram
9. Improve the reusability and maintainability of the software system by
applying appropriate design patterns.
10.
Implement the modified system and test it for various scenarios
SUGGESTED DOMAINS FOR MINI-PROJECT:
1. Passport automation system.
2. Book bank
3. Exam registration
4. Stock maintenance system.
5. Online course reservation system
6. Airline/Railway reservation system
7. Software personnel management system
8. Credit card processing
9. e-book management system
10. Intended system
11. Foreign trading system
12. Conference management system
13. BPO management system
14. Library management system
15. Student information system
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
2
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
3
EX NO : 1 IDENTIFICATION OF SOFTWARE SYSTEM
AIM:
To identify the software system.
OBJECTIVE:
To understand the project
To understand the creation of User Interface and database
To understand the working of each module
PROBLEM STATEMENT:
Description:
Intended system is an interface between the Applicant and the organization
It aims at improving the efficiency in the System and reduces the complexities
involved in it to the maximum possible extent. This Intended system is
developed
for the post of Marketing Manager
Scope:
The system provides an online interface to the user where they can fill in their personal
details and apply for the job.
The organisation (HR Department) concerned with the system can make use of this
system to reduce their workload and process the application ina speedy manner
Provide a communication platform between the applicant and the organization
Module Description:
Registration / Sign up:
Initially the registration must be done by the applicant
Then the details of the applicantmust be filled
The applicant must create a username and password for future login purposes
Login:
The applicant logins by entering the created username and password
Biodata:
Personal Details:
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
4
Academic Details:
Experience details:
Constraints for the selection of Applicants:
The biodtaa filled by the applicant is to be submitted.
The applicants are filtred based on the following criteria
The Applicant must have an MBA degree
The applicant must have an experience of atleast two years
The applicant must have good communication skills
Selection Process:
Based on the above constraints , the applicants are being selected by the HR
department.
The selected applicants are informed about the online test which is to be
carried out for the further selection process
Online Test:
The selected applicants have to attend an online Test conducted by the
organization
The online test comprises of both objective and subjective questions in order to
test the Business Adminsration and Communication Skills
Announcing the Result:
Based on the performance of the Applicant in the online Test the applicants
are selected and are further appointed
The result is displayed after the completion of the online test
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The software system for Intended system is identified.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
5
EX NO : 2 DEVELOPMENT OF SOFTWARE REQUIREMENTS
SPECIFICATION (SRS)
AIM:
To develop software requirements specification .
OBJECTIVE:
To introduce the concepts of user and system requirements
● To describe functional and non-functional requirements
● To explain how software requirements may be organized in a requirements document
SOFTWARE REQUIREMENT SPECIFICATION:
1. INTRODUCTION
Intended system is an interface between the Applicant and the organization
responsible for the process. It aims at efficiently implementing the System and reducing
the complexities involved in it to the maximum possible extent.
1.1 Purpose
If the entire process is done manually then it would take several days to complete.
Considering the fact that the number of applicants for the system is increasing every
year, an automated system becomes essential to meet the demand. So this system uses
several techniques to elucidate the work involved in this process.
1.2 Intended Audience
The applicants who are interested in the post of Marketing Manager
1.3 Intended Use
To automate the System in order to increase the efficiency and reduce the
complexities involved in it to a maximum extent.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
6
1.4 Scope
The system provides an online interface to the user where they can fill in their
personal details and apply for the job.
The organization (HR Department) concerned with the system can make use
of this system to reduce their workload and process the application in a
speedy manner
Provide a communication platform between the applicant and the organization.
1.5 Definitions and Acronyms (Sample)
Applicant - One who applies for the job
Organization - The organization for which the applicant applies for the job
HR - The central authority with the privilege to manage the selection process
Admin - The entire details of the applicant, Registration and Login process are
being managed by the admin.
2. OVERALL DESCRIPTION
Overall description describes the major roles of the system components and its inter
connections. The intended system acts as an interface between the applicant and the
organization. This system increases the efficiency and also reduces the complexities
involved in it.
The system minimizes the time duration . The applicant submits the biodata and
based on certain constraints, the application is being selected/ rejected and the final
results are being announced It also involves taking up an online test.
2.1 User Needs
Applicant: The applicant initially registers, logins and also submits the bio
data through the system. After the short listing of applications, the applicant
attends an online test based on which the decision of selection/ rejection is
made.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
7
Admin: The entire details entered by the applicant are being verified and
processed by the admin.
HR: Based on the applications being received, the HR selects the applicant
based on certain predefined constraints.
2.2 Assumptions and Dependencies
The HR is an authenticated person who plays the major role in the selection of
applications.
The online test contains only 10 questions.
The test will be active only for 10 minutes.
The applicants must have basic knowledge of computers.
3. SYSTEM FEATURES AND REQUIREMENTS
3.1 Functional Requirements
Initially, the registration must be done by the applicant and also a username
and password is being created. The entire details is verified by the admin.
The applicant logins by entering the created username and password.
The personal details, academic details and the experience details are being
entered by the applicant and submitted.
Based on certain constraints, the HR short lists the applicant and an online test
is being conducted.
The result is announced based on the online tests performance.
3.2 External Interface Requirements
A Graphical user interface is being created for an interaction between user and
system.
3.3 System Features
Hardware
OS: Windows
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
8
Processor: i7
Ram: 8.00 GB
Software
Java
Net beans
Registration and login must be done by the applicant and the personal, academic,
experience details are entered in the biodata and is being submitted to the HR. The
selection process is done based on certain constraints and an online test is being conducted
and the result is displayed.
3.4 Non-functional Requirements
Performance
The performance of the system must be good
Safety
The system must be reliable and safe
Security
The intended system must be secured and safe
Quality
The system is being updated time to time inorder to increase the efficiency
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The Software Requirements Specification is developed.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
9
EX NO : 3 IDENTIFICATION OF USE CASES AND DEVELOPMENT OF
USE CASE MODEL
AIM :
To identify use cases and develop use case model .
OBJECTIVE:
To understand the functional requirements of the system
To model the system from the point of view of how users and other systems interact
with the system under discussion
SOFTWARE REQUIRED
Rational Rose
DESCRIPTION:
The use case is a methodology used in system analysis to identify, clarify, and organize
system requirements. The use case is made up of a set of possible sequences of
interactions between systems and users in a particular environment and related to a
particular goal. The use case should contain all system activities that have significance to
the users. A use case can be thought of as a collection of possible scenarios related to a
particular goal. A use case represents the list of tasks that actors can perform, and is directly
related to the requirements of the business process. Use cases define interactions between
external actors and the system to attain particular goals. There are three basic elements that
make up a use case:
Actors: Actors are the type of users that interact with the system.
System: Use cases capture functional requirements that specify the intended
behavior of the system.
Goals: Use cases are typically initiated by a user to fulfill goals describing the
activities and variants involved in attaining the goal.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
10
FORMAT OF FULLY DRESSED USECASE:
USE CASE DIAGRAM NOTATIONS:
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
11
LIST OF USE CASES:
Registration
Login
Filling biodata
Take test
Announce result
FULLY DRESSED USE CASE:
Usecase Name :
Fill Biodata
Scope:
Intended system
Level:
User goal
Primary Actor :
User
Stakeholder and Interests
User - Needs to fill the Bio data form
HR - Needs to short list the filled bio data form
Precondition:
The user must have a MBA degree
Success Guarantee:
The user will be allowed to attend the test only when all details are convincing
Main Success Scenario
1. User must login to the system
2. User need to fill the bio data form
3. HR verifies the user’s detail and select the user
4. The selected user will be asked to attend the test
3a. If the required conditions are not present
1. The reject message will be displayed by the admin
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
12
Special Requirement
The duration of the test is 10 minutes
Technology and dta variations List
Nil
Frequecy of occurance:
Could be nearly continuous
USE CASE DIAGRAM:
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The use cases are identified and use case model is developed
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
13
EX NO : 4 IDENTIFICATION OF CONCEPTUAL CLASSES AND
DEVELOPMENT OF DOMAIN MODEL AND CLASS DIAGRAM
AIM :
To identify conceptual classes and develop domain model and class diagram
OBJECTIVE:
To identify the relevant concepts and ideas of the domain
To decompose the domain into individual conceptual classes
To identify the attributes , operations and associations of classes
SOFTWARE REQUIRED
Rational Rose
DESCRIPTION:
A domain model is a visual representation of real-world conceptual classes. A
domain model is illustrated with a set of class which may have
domain objects or conceptual classes
associations between conceptual classes
attributes of conceptual classes
Class diagram is a static diagram which represents the static view of an application.
Class diagram describes the attributes and operations of a class and also the constraints
imposed on the system.
Essential elements of UML class diagram are:
Class Name:
The name of the class appears in the topmost compartment.
A class name should always start with a capital letter.
A class name should always be in the center of the first compartment.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
14
A class name should always be written in bold format.
An abstract class name should be written in italics format.
Attributes:
An attribute is a named property of a class which describes the object being modelled. In
the class diagram, this component is placed just below the name-compartment.
The attributes are generally written along with the visibility factor.
Public, private, protected and package are the four visibilities which are
denoted by +, -, #, or ~ signs respectively.
Visibility describes the accessibility of an attribute of a class.
Relationships:
Different kinds of relationships can be represented inUML:
Dependency -indicates that one class depends on another.
Generalization-helps to connect a subclass to its superclass
Association-represents static relationships between classes
Aggregation-models a whole- part relationship between aggregate and its
parts.
Composition-denotes strong ownership between two classes when one
class is a part of another class.
Multiplicity
It specifies how many instances of attributes are created when a class is initialized.
Exactly one - 1
Zero or one - 0..1
Many - 0..* or *
One or more - 1..*
Exact Number - e.g. 3..4 or 6
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
15
If a multiplicity is not specified, by default one is considered as a default multiplicity.
CLASS DIAGRAM:
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The conceptual classes are identified, domain model and class diagram are developed
.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
16
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
17
EX NO : 5 REPRESENTATION OF INTERACTION BETWEEN
OBJECTS USING SEQUENCE AND COLLABORATION DIAGRAMS
AIM :
To represent the interaction between objects using sequence diagram and
collaboration diagram .
OBJECTIVE:
To identify the dynamic behaviour of the system
To illustrate how objects interact via messages
To represent the order of messages flowing from one object to another.
SOFTWARE REQUIRED
Rational Rose
DESCRIPTION:
The interaction diagram is used to describe interactions among the different elements
in the model which is a part of dynamic behaviour of the system. It helps to visualize the
interactive behaviour of the system. It is represented in UML by two diagrams known as
Sequence diagram
Collaboration or Communication diagram
The sequence diagram illustrates the interaction in a fence format where each object is
added to the right. The collaboration diagram illustrates object interactions in a graph or
network format, in which objects can be placed anywhere on the diagram.
Sequence Diagram Notations
Lifeline Notation
Message
attribute = message_name (arguments): return_type
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
18
Synchronous message
Asynchronous message
Reflexive message
Collaboration Diagram Notations
1. message1
Object Object
2. message2
Reflexive message Object
1. message1
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
19
SEQUENCE DIAGRAM:
COLLABORATION DIAGRAM
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The interaction between objects are represented using sequence diagram and
collaboration diagram .
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
20
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
21
EX NO : 6 CONSTRUCTION OF STATE CHART AND ACTIVITY DIAGRAM
AIM :
To construct state chart and activity diagram .
OBJECTIVE:
To identify the dynamic behaviour of the system.
To illustrate the different states of an object during its life time.
To describe the parallel, branched and concurrent flow of activities in the system
SOFTWARE REQUIRED
Rational Rose
DESCRIPTION:
STATE CHART DIAGRAM:
The state chart diagram defines the different states of an object during its lifetime
and these states change by events. It describes the flow of control from one state to
another state. States are defined as a condition in which an object exists and it changes
when some event is triggered. The most important purpose of State chart diagram is to
model lifetime of an object from creation to termination. Events are internal or external
factors influencing the system.
States
States represent situations during the life of an object. It is represented by a rectangle
with rounded corners.
Transition
A solid arrow represents the path between different states of an object. Label the
transition with the event that triggered it and the action that results from it. A state can have
a transition that points back to itself.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
22
Initial State
A filled circle followed by an arrow represents the object's initial state.
Final State
An arrow pointing to a filled circle nested inside another circle represents the object's
final state.
ACTIVITY DIAGRAM:
Activity diagram is basically a flowchart to represent the flow from one activity to
another activity. The activity can be described as an operation of the system. The control
flow is drawn from one operation to another. This flow can be sequential, branched, or
concurrent. Activity diagrams deal with all type of flow control by using different elements
such as fork, join, etc
Initial State or Start Point
A small filled circle followed by an arrow represents the initial action state or the start
point for any activity diagram.
Activity or Action State
An action state represents the non-interruptible action of objects. Ity can be
represented by a rectangle with rounded corners.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
23
Action Flow
Action flows, also called edges and paths, illustrate the transitions from one action
state to another. They are usually drawn with an arrowed line.
Object Flow
Object flow refers to the creation and modification of objects by activities. An object
flow arrow from an action to an object means that the action creates or influences the object.
Decisions and Branching
A diamond represents a decision with alternate paths. The outgoing alternates should
be labelled with a condition or guard expression. One of the paths can be specified as
"else."
Synchronization
A fork node is used to split a single incoming flow into multiple concurrent flows.
A join node joins multiple concurrent flows back into a single outgoing flow.
A fork and join mode used together are often referred to as synchronization.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
24
Time Event
It refers to an event that stops the flow for a time; an hourglass depicts it.
STATE CHART DIAGRAM:
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
25
ACTIVITY DIAGRAM:
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The state chart and activity diagram are constructed .
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
26
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
27
EX NO : 7 IMPLEMENTATION OF THE DESIGN
AIM :
To implement the the system by mapping the design to code.
OBJECTIVE:
To understand the object oriented concepts in Java.
To understand the concept of mapping design to code.
SOFTWARE REQUIRED
Java Development Kit (JDK 1.7.0)
Net Beans- IDE
ALGORITHM:
1. Create the classes Registration, Login, Biodata and Questions
2. Declare the required methods in the specified classes
3. In class biodata, if the candidate qualification is MBA and the experience is greater
than or equal to 2 years candidate will be short listed.
4. If not the candidate will be rejected
5. In class questions, if the candidate answer all questions correctly, he will be selected
6. If not the candidate will be rejected
PROGRAM :
import java.io.*;
import java.util.*;
class reg
{
ArrayList<String> name=new ArrayList<String>();
ArrayList<String> dob=new ArrayList<String>();
ArrayList<String> contact=new ArrayList<String>();
ArrayList<String> email=new ArrayList<String>();
ArrayList<String> uname=new ArrayList<String>();
ArrayList<String> pswd=new ArrayList<String>();
Scanner s=new Scanner(System.in);
void signup()
{
System.out.println("******REGISTRATION******");
System.out.print("Name:");
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
28
name.add(s.next());
System.out.print("DOB:");
dob.add(s.next());
System.out.print("Contact:");
contact.add(s.next());
System.out.print("email id:");
email.add(s.next());
System.out.print("Username:");
uname.add(s.next());
System.out.print("Password:");
pswd.add(s.next());
}
void display()
{
System.out.println("######Details#######"+"\n"+name+"\n" +dob+"\n" +contact+"\n"
+email+"\n" +uname+"\n" +pswd+"\n");
}
}
class login{
ArrayList<String> user = new ArrayList<>();
ArrayList<String> p = new ArrayList<>();
String username,pwd;
int flag=0;
Scanner scan=new Scanner(System.in);
void getdata()
{
System.out.println("*********ENTER LOGIN DETAILS*********");
System.out.print("Enter user name:");
username = scan.nextLine();
System.out.print("Enter password:");
pwd = scan.nextLine();
check();
}
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
29
void check()
{ String t,k;
user.add("Madhu");
user.add("meera");
p.add("stupid");
p.add("cric");
for(int i=0;i<user.size();i++)
{
t=user.get(i);
k=p.get(i);
if(t==username && k==pwd);
flag=1;
}
if(flag==1)
{
System.out.println("LOGIN SUCCESSFUL!!!!");
}
else
{
System.out.println("INAVLID CREDENTIALS...");
}
}
}
class biodata
{
int a;
int exp;
ArrayList<String> name=new ArrayList<String>();
ArrayList<String> dob=new ArrayList<String>();
ArrayList<String> parentname=new ArrayList<String>();
ArrayList<String> mobnumber=new ArrayList<String>();
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
30
ArrayList<String> email=new
ArrayList<String>(); ArrayList<String> addr=new
ArrayList<String>(); String quali;
ArrayList<String> currsalary=new ArrayList<String>();
Scanner s1=new Scanner(System.in);
void data()
{
System.out.println("!!!!!!!!BIO-DATA!!!!!!");
System.out.print("NAME:");
name.add(s1.next());
System.out.print("DOB:");
dob.add(s1.next());
System.out.print("PARENT NAME:");
parentname.add(s1.next());
System.out.print("MOBILE NUMBER:");
mobnumber.add(s1.next());
System.out.print("E-MAIL ID:");
email.add(s1.next());
System.out.print("ADDRESS:");
addr.add(s1.next());
System.out.print("QUALIFICATION:");
quali=s1.next();
System.out.print("EXPERIENCE:");
exp=s1.nextInt();
System.out.print("CURRENT SALARY:");
currsalary.add(s1.next());
}
void display()
{
System.out.println("%%%%%%BIO-DATA%%%%%%"+"\n" +name+"\n" +dob+"\n"
+parentname+"\n" +mobnumber+"\n" +email+"\n" +addr+"\n" +quali+"\n" +exp+"\n"
+currsalary +"\n");
}
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
31
void select()
{
String a="MBA";
if((exp>=2)&&(quali.equals(a))){
System.out.println("Attend Test");}
else
{
System.out.println("Better Luck Next Time!!");
System.exit(0);
}
}
}
class questions
{
void que()
{
System.out.println("1)The sum of ages of 5 children born at the intervals of 3 years each is
50 years. What is the age of the youngest child?");
System.out.println("1)4 years 2)8 years 3)10 years 4)None of these");
System.out.println("2)A father said to his son,I was as old as you are at the present at the
time of your birt. If the father's age is 38 years now, the son's age five years back was:");
System.out.println("1)14 years 2)19 years3)33 years 4)38 years");
System.out.println("3)A is two years older than B who is twice as old as C. If the total of the
ages of A, B and C be 27, then how old is B");
System.out.println("1)7 2)8 3)9 4)10");
}
void ans()
{
int a[]=new int[4];
Scanner s2=new Scanner(System.in);
for(int i=1;i<=3;i++)
{
System.out.println("Enter the answer"+i);
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
32
a[i]=s2.nextInt();
}
if((a[1]==1)&&(a[2]==1)&&(a[3]==4))
{
System.out.println("you are selected");
}
else
{
System.out.println("you are rejected");
}
}
}
class main
{
public static void main(String args[])
{
reg obj=new reg();
login obj1=new login();
biodata obj2=new biodata();
questions obj3=new questions();
obj.signup();
obj.display();
obj1.getdata();
obj1.check();
obj2.data();
obj2.display();
obj2.select();
obj3.que();
obj3.ans();
}
}
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
33
OUTPUT:
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The system is implemented using object oriented concepts.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
34
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
35
EX NO : 8 TESTING THE SOFTWARE SYSTEM
AIM :
To test the implementation of the system using Unit testing.
OBJECTIVE:
To understand the concept of Unit Testing
To understand the procedure for testing using JUnit (Name of the tool used)
SOFTWARE REQUIRED
Java Development Kit (JDK 1.7.0)
Net Beans- IDE
JUnit
DESCRIPTION:
Unit testing is an important part of Test Driven Development (TDD). It helps to find
problems in the code as early as possible. When changes are made to the existing code the
unit tests can be run again to make sure that the changes do not break the application
(regression). The unit test should be written and run to ensure that the code meets its design
and behaves as intended.
JUnit is one of the most popular unit testing frameworks for Java development.
Eclipse and NetBeans supports JUnit - the IDE is shipped with JUnit as its default testing
library. Thus writing and running unit tests with JUnit in Eclipse and NetBeans is quick, easy
and productive.
The naming convention for a test class is, the name of the class being tested followed
by Test. The methods in this class are marked with some JUnit annotations which have
special meaning. Except the test methods, the other kinds of method are optional.
@BeforeClass:
Code in this method is executed only once, before all test methods in the test class.
@Before:
Code in this method is executed before every test method in the test class.
@Test:
This specifies the annotated method is a test method. The naming convention for test
method is, the method name prefixed with test
@After:
Code in this method is executed after every test method in the test class.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
36
@AfterClass:
Code in this method is executed only once, after all test methods in the test class.
In a test method, assert statement can be used to verify whether the code under test
produces the result as expected or not. If the result is as expected, the tested code passes
the test case. Otherwise the tested code fails the test case.
assertEquals(expected, actual);
It has to be imported using the statement
import static org.junit.Assert.assertEquals;
The assertEquals() method compares two values: the expected result and the actual value
returned from the tested code.
If the two values are equal, the method returns normally indicating the tested code passes
the test case. If the two values are not equal, the method throws java.lang.AssertionError
indicating the tested code fails the test case. The code has to be fixed until it passes the test
case. The fail() method is used to indicate that the test fails
The different forms of assert methods supported by JUnit are:
assertEquals(expected, actual): asserts that the two values are equal. The values
can be of any primitive types or Objects.
assertEquals("Sum is not correct", expected, actual): asserts that the two values
are equal. It specifies a message which will be printed in the exception if the code
fails.
assertNotEquals(expected, actual): asserts that the two arguments are not equal.
The values can be of any primitive types or Object.
assertTrue(boolean condition): asserts that a condition is true.
assertFalse(boolean condition): asserts that a condition is false.
assertNull(Object): asserts that an object is null.
assertNotNull(Object): asserts that an object is not null.
assertSame(Object expected, Object actual): asserts that the two objects refer to
the same object.
assertNotSame(Object unexpected, Object actual): asserts that the two objects do
not refer to the same object.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
37
TEST CODE AND OUTPUT:
LOGIN:
package recruit;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class loginTest {
public loginTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public void testGetdata() {
System.out.println("getdata");
login instance = new login();
String expResult = "login successfull";
String result = instance.getdata();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
38
}
}
REGISTRATION:
package recruit;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class regTest {
public regTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
39
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void testSignup() {
System.out.println("signup");
reg instance = new reg();
String expResult = "successful";
String result = instance.signup();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");
}
@Test
public void testDisplay() {
System.out.println("display");
reg instance = new reg();
String expResult = "successful";
String result = instance.display();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");
}
}
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
40
BIODATA:
package recruit;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class biodataTest {
public biodataTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
41
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void testData() {
/* System.out.println("data");
biodata instance = new biodata();
instance.data();
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");*/
}
@Test
public void testDisplay() {
System.out.println("display");
biodata instance = new biodata();
instance.display();
// TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
}
@Test
public void testSelect() {
System.out.println("select");
biodata instance = new biodata();
String expResult = "Attend Test";
String result = instance.select();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");
}
}
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
42
QUESTIONS:
package recruit;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class questionsTest {
public questionsTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
43
}
@After
public void tearDown() {
}
@Test
public void testQue() {
System.out.println("que");
questions instance = new questions();
instance.que();
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");
}
@Test
public void testAns() {
System.out.println("ans");
questions instance = new questions();
String expResult = "YOU ARE SELECTED";
String result = instance.ans();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");
}
}
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
44
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The implementation of the system is tested using JUnit.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
45
EX NO : 9 APPLICATION OF DESIGN PATTERNS
AIM :
To apply various General Responsibility Assignment Software Pattern(GRASP) to the
system.
OBJECTIVE:
To understand the concept of GRASP design patterns
To identify the solutions to the GRASP design patterns
SOFTWARE REQUIRED
Java Development Kit (JDK 1.7.0)
Net Beans- IDE
JUnit
DESCRIPTION:
Design patterns are solutions for most common and frequent problems that occur
while designing a software. These patterns are mostly “evolved” rather than “discovered”.
The design pattern sets responsibilities for objects and classes in object-oriented program
design. Design patterns helps to keep the code simpler, organized, comprehensible,
analyzable and reusable.
Creator
Problem:
Who should be responsible for creating a new instance of some class?
Solution:
Assign class B the responsibility to create an instance of class A if one of these is
true (the more the better):
1. B "contains" or compositely aggregates A.
2. B records A.
3. B closely uses A.
4. B has the initializing data for A that will be passed to A when it is created. Thus
B is an Expert with respect to creating A.
Information Expert (or Expert)
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
46
Problem:
What is a general principle of assigning responsibilities to objects?
Solution:
Assign a responsibility to the information expert - the class that has
the information necessary to fulfil the responsibility.
Low Coupling
Problem:
How to support low dependency, low change impact, and increased reuse?
Solution:
Assign a responsibility so that coupling remains low. Use this principle to
evaluate alternatives.
Controller
Problem:
What first object beyond the UI layer receives and coordinates ("controls") a
system operation?
Solution:
Assign the responsibility to a class representing one of the following choices:
1. facade controller.
2. use case or session controller.
High Cohesion
Problem:
How to keep objects focused, understandable, and manageable, and as a side
effect, support Low Coupling?
Solution:
Assign a responsibility so that cohesion remains high. Use this to evaluate
alternatives.
APPLYING DESIGN PATTERNS :
Creator:
Applicant class is responsible for creating new instance of the class Biodata. In applicant
class, the applicant will fill the application form. Then while selecting the submit button it will
enter into Biodata class.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
47
Information Expert:
Application class is the Information Expert for login information. Biodata class is the
information expert for user personal detail information. HR class is the information expert for
validation information.
Low Coupling:
The admin class is responsible for both the registration and the application class. In
registration class, the admin will allow the user to register their details and to enter their
username and password. In applicant class the admin will allow the user to confirm their
details and then allow them to enter into Biodata class.
Controller:
The admin class is responsible for the initial registration process. Submitting the
application form and announcing the result to the candidate.
High Cohesion:
Applicant class processes mainly on applicant login information. Biodata class focuses
mainly on the user personal and academic details. The HR class focuses mainly on the
validation process. Without implementing all the task in a single class are separated and
implemented in various classes.
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The various design patterns of GRASP are applied to the system.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
48
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
49
EX NO : 10 IMPLEMENTATION AND TESTING OF THE MODIFIED SYSTEM
AIM :
To implement and test the modified system.
OBJECTIVE:
To understand the object oriented concepts in Java.
To understand the concept of mapping design to code.
SOFTWARE REQUIRED
Java Development Kit (JDK 1.7.0)
Net Beans- IDE
Junit
SAMPLE PROGRAM :
import java.io.*;
import java.util.*;
class reg{
ArrayList<String> name=new ArrayList<String>();
ArrayList<String> dob=new ArrayList<String>();
ArrayList<String> contact=new ArrayList<String>();
ArrayList<String> email=new ArrayList<String>();
ArrayList<String> uname=new ArrayList<String>();
ArrayList<String> pswd=new ArrayList<String>();
Scanner s=new Scanner(System.in);
void signup(){
System.out.println("******REGISTRATION******");
System.out.print("Name:");
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
50
name.add(s.next());
System.out.print("DOB:");
dob.add(s.next());
System.out.print("Contact:");
contact.add(s.next());
System.out.print("email id:");
email.add(s.next());
System.out.print("Username:");
uname.add(s.next());
System.out.print("Password:");
pswd.add(s.next());
void display(){
System.out.println("######Details#######"+"\n"+name+"\n" +dob+"\n" +contact+"\n"
+email+"\n" +uname+"\n" +pswd+"\n");
class login{
ArrayList<String> user = new ArrayList<>();
ArrayList<String> p = new ArrayList<>();
String username,pwd;
int flag=0;
Scanner scan=new Scanner(System.in);
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
51
void getdata() {
System.out.println("*********ENTER LOGIN DETAILS*********");
System.out.print("Enter user name:");
username = scan.nextLine();
System.out.print("Enter password:");
pwd = scan.nextLine();
check();
void check() {
String t,k;
user.add("Madhu");
user.add("meera");
p.add("stupid");
p.add("cric");
for(int i=0;i<user.size();i++) {
t=user.get(i);
k=p.get(i);
if(t==username && k==pwd);
flag=1;
if(flag==1){
System.out.println("LOGIN SUCCESSFUL!!!!");
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
52
}
else {
System.out.println("INAVLID CREDENTIALS...");
class biodata{
int a;
int exp;
ArrayList<String> name=new ArrayList<String>();
ArrayList<String> dob=new ArrayList<String>();
ArrayList<String> parentname=new ArrayList<String>();
ArrayList<String> mobnumber=new ArrayList<String>();
ArrayList<String> email=new ArrayList<String>();
ArrayList<String> addr=new ArrayList<String>();
String quali;
ArrayList<String> currsalary=new ArrayList<String>();
Scanner s1=new Scanner(System.in);
void data(){
System.out.println("!!!!!!!!BIO-DATA!!!!!!");
System.out.print("NAME:");
name.add(s1.next());
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
53
System.out.print("DOB:");
dob.add(s1.next());
System.out.print("PARENT NAME:");
parentname.add(s1.next());
System.out.print("MOBILE NUMBER:");
mobnumber.add(s1.next());
System.out.print("E-MAIL ID:");
email.add(s1.next());
System.out.print("ADDRESS:");
addr.add(s1.next());
System.out.print("QUALIFICATION:");
quali=s1.next();
System.out.print("EXPERIENCE:");
exp=s1.nextInt();
System.out.print("CURRENT SALARY:");
currsalary.add(s1.next());
void display(){
System.out.println("%%%%%%BIO-DATA%%%%%%"+"\n" +name+"\n" +dob+"\n"
+parentname+"\n" +mobnumber+"\n" +email+"\n" +addr+"\n" +quali+"\n" +exp+"\n"
+currsalary +"\n");
void select(){
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
54
String a="MBA";
if((exp>=2)&&(quali.equals(a))){
System.out.println("Attend Test");}
else{
System.out.println("Better Luck Next Time!!");
System.exit(0);
class questions{
void que(){
System.out.println("1)The sum of ages of 5 children born at the intervals of 3 years each is
50 years. What is the age of the youngest child?");
System.out.println("1)4 years 2)8 years 3)10 years 4)None of these");
System.out.println("2)A father said to his son,I was as old as you are at the present at the
time of your birt. If the father's age is 38 years now, the son's age five years back was:");
System.out.println("1)14 years 2)19 years 3)33 years 4)38 years");
System.out.println("3)A is two years older than B who is twice as old as C. If the total of the
ages of A, B and C be 27, then how old is B");
System.out.println("1)7 2)8 3)9 4)10");
void ans(){
int a[]=new int[4];
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
55
Scanner s2=new Scanner(System.in);
for(int i=1;i<=3;i++){
System.out.println("Enter the answer"+i);
a[i]=s2.nextInt();
if((a[1]==1)&&(a[2]==1)&&(a[3]==4)){
System.out.println("you are selected");
else{
System.out.println("you are rejected");
class main{
public static void main(String args[]){
reg obj=new reg();
login obj1=new login();
biodata obj2=new biodata();
questions obj3=new questions();
obj.signup();
obj.display();
obj1.getdata();
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
56
obj1.check();
obj2.data();
obj2.display();
obj2.select();
obj3.que();
obj3.ans();
}}
LOGIN:
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
57
REGISTRATION:
BIODATA:
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
58
QUESTIONS:
OUTPUT:
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY
59
REAL TIME APPLICATIONS:
Software Project Development in Companies
Online Management System
Examination Portal
Student Information System
RESULT:
The modified system is tested and implemented successfully.
DEPARTMENT SUBJECT COLLEGE
CSE OBJECT ORIENTED SOFTWARE ENGINEERING MSEC, Chennai-24
LABORATORY