88020750
-
Upload
sathishdon01 -
Category
Documents
-
view
217 -
download
0
Transcript of 88020750
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 1/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
1
PROGRAM 2: GRID LINES
import javax.swing.*;
import java.awt.*;import java.awt.event.*;
class Design extends JFrame{
Container cp;Design()
{cp=getContentPane();cp.setLayout(null);
Adapter ad=new Adapter(this);addWindowListener(ad);
repaint();}
public void paint(Graphics g){
for(int i=0;i<=800;i+=10){
g.drawLine(i,0,i,800);
g.drawLine(0,i,800,i);
}
}
class Adapter extends WindowAdapter
{Design dd;public Adapter(Design d)
{dd=d;
}
public void windowClosing(WindowEvent we)
{System.exit(0);
}}
public static void main(String s[]){
Design d1=new Design();d1.setSize(500,500);d1.setVisible(true);
}
}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 2/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
2
PROGRAM 3: GRID WITH TWO SETS OF DIAGONAL LINES
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Design1 extends JFrame{
Container cp;Design1(){
cp=getContentPane();cp.setLayout(null);
Adapter ad=new Adapter(this);addWindowListener(ad);
repaint();
}
public void paint(Graphics g){for(int i=0,j=1000;i<=1000;i+=10,j-=10)
{g.drawLine(0,i,i,0);
g.drawLine(i,0,1000,j);g.drawLine(0,i,j,1000);
}}
class Adapter extends WindowAdapter{Design1 dd;
public Adapter(Design1 d){
dd=d;}
public void windowClosing(WindowEvent we){
System.exit(0);}}
public static void main(String s[])
{Design1 d1=new Design1();d1.setSize(500,500);
d1.setVisible(true);
}}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 3/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
3
PROBLEM 4
Problem definition
In employee referral process, the HR head of the region where a vacancy existsinforms employees of that region and other regional HR heads. The other regional HR
heads inform employees by putting up a notice informing them about the vacancy. Theemployees send on their recommendations to the regional HR head of the region where a
vacancy exists. The regional HR head then matches the skills of these candidates with theskills required for the vacant position and shortlist them. An interview schedule is drawnup and the short listed candidates are informed. Based on the interview processing,
interview details are updated and all the selected candidates are given offer letter. Thecandidate informs the HR (head where the vacancy exists) either by accepting or
declining the offer letter. When a candidate referred by an employee joins theorganization, the employee who has referred the candidate is paid a bonus.
a) Identify various use cases and actors involved and represent the user view of thesystem.
b) Identify the various classes and attributes and bring out a class diagram, and asequence diagram.
REQUIREMENTS SPECIFICATION
The process shall result in the recruitment of employees for the vacancy that has
become available in a particular region.
The total candidates considered for the process shall be made available by a
referral system from the existing employees of the organization.
The HR head of a particular region shall inform details about the vacancy to
employees of his/her region and also inform the other HR heads of the samevacancy.
The references from the other HR heads shall be made available to the region thathas the vacancy.
The candidates that meet the requirements of the vacancy shall be short listed for
the selection process.
The interview process is conducted and the candidates are selected to meet the
vacancy of the region.
The selected candidates are informed and are requested to accept the job offer.
Based on whether the candidate accepts the job offer bonuses shall be awarded to
the employee that referred the candidate.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 4/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
4
Actors:
Actors are as follows:
1.HR Head.
2.Employee.
3.Candidates.
Actors Documentation:
1.HR Head:
HR Head is an actor who informs about the vacancy to their employees and also
other regional HR Heads, who in turn informs their respective Employees and alsomatches the skills of the referred Candidates with their skills, required for the vacantposition and shortlist them. HR Head is also responsible for Interview Scheduling.
2.Employee:
Employee is an actor who references the Candidates regardless of his/her region
and receives the incentives provided the referred Candidate got selected
3.Candidate:
Candidate is an actor who is referred by an Employee of the Company and applies
for the vacancy. If the Candidate gets selected then they informs the HR Head about the
acceptance or rejection of the offer letter.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 5/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
5
Use-Case Diagram:
<<Uses>>
Notify Vacancy
Intimation to SelectedCandidates
Employee
Interview Process
Selection of EligibleCandidates
Candidate
HR Head
Fill referral Form
<<Extends>>
<<Extends>>
Award Bonus
Accept/Decline Offer
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 6/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
6
USE CASES:
Use Case: Notify Vacancy
Description : This Use Case is initiated by HR and the Employee.Notifies about the vacancies to employees of the region.
Flow of Events: 1. HR Head sends Email notification to his/her employees.2. HR Head informs about vacancy to other region HR heads.3. Other HR heads in turn inform their employees.
Pre-Condition: Vacancy must exist.Post-Condition: Details about the vacancy are informed.
Use Case: Filling of FormsDescription: This Use Case is initiated by HR and the Employee.
Online forms are filled by the employees.
HR head processes the forms and determines eligible candidates.Flow of Events: 1. Employees fill out online forms of candidates they want to refer.
2. HR head processes the filled forms.
3. HR heads selects the list of eligible candidates.Pre-Condition: Online form must exist.
Post-Condition: Forms filled are stored in a Information System for processing.The filled forms are sent to the HR.The HR head produces the list of eligible candidates.
.
Use Case: Short Listing of CandidatesDescription This Use Case is initiated by Candidate and HR.
The Interviews are conducted by the HR head of the region that has
the vacancy.The list of selected candidates are obtained after the interview
process.Flow of Events: 1. HR head schedules the interview process.
2. HR head conducts the interview for the candidates via online
system.3. Candidates who clear the interview process are selected.
Pre-Condition: Candidate must meet eligibility criteria.Candidate must be referenced by the employee of that organization.
Post-Condition Candidate clears interview process.
ORCandidate doesn’t clear interview process.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 7/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
7
Use Case : Intimation to the selected candidates.Description: This Use Case is initiated by the HR Head and the Candidate
The candidate accepts or rejects the offer letter to fill the vacancy.Bonus is awarded to the employee who referred the candidate.
Flow of Events 1. Candidate is informed about selection the job.
2. Candidate accepts the job offer to fill the vacancy.3. Bonus is awarded to the employee who referred the candidate.
Alternate Flow 1. Candidate rejects the offer letter.2. Candidate application is rejected.
3. No Bonus is awarded to the employee who referred thecandidate.
Pre-Condition: Candidate is selected for the job.
Post-Condition: Candidate accepts or rejects the offer.Bonus is awarded to the employee who referred the candidate if
he/she accepts the offer.
Sequence Diagram:
Notify Vacancy:
: HR Head EmailSystem : Employee
1: Informs about Vacancy 2.Recieves Vacancy
Information
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 8/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
8
Fill Referral Process:
: HR Head
Online Form IS: Employee
1: Refers Candidate
2: Upload Details
3: Refers Candidate
4: Upload Details
5: Retrive the Candidate List
Selection of Candidates:
: HR HeadOnline Interview
SystemIS
: Candidate
1: Initiate Interview
2: Reply to the Queries
3: Receives reply
4: Stores Shortlisted Candidate Details
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 9/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
9
Intimation [Accepts Offer Letter]:
: HR HeadEmailSystem : Candidate : Employee
1: Sends Offer Letter
2: Receives Offer Letter
3: Accepts Offer Letter
4: Recieves Acceptance
5: Informs about bonus awarded
6: Recieves Bonus Noti fication
Intimation [Rejection]:
: HR HeadEmailSystem
: Candidate
1: sends offer Letter
2: recieves Offer Letter
3: Reject Offer Letter
4: recieves the rejection
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 10/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
10
CLASS DIAGRAM
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 11/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
11
Class Diagram Documentation
Employee:
The employee class is used to store details about the employees of a particular
region. This information shall be used later to award bonuses provided the candidatesthey refer get selected to fill the job vacancy.
HR Head:
This class is the main class. The HR is responsible for collecting the details of thecandidates being referred. It is also the HR job to conduct the interview, shortlist thecandidates and also intimate the selected candidates about the job.
Maintenance:
The Maintenance class is responsible for maintaining the Information System(IS)where the information about the candidates and the employees are stored.
Vacancy Details:
This class contains the details of the vacancy that are to be filled. Here a Job Code
is assigned to keep information about each vacancy detailing the type of job, thedesignation and the No. Of vacant posts.
Candidate:
The candidate class contains the details about the candidates being referred by the
employees. The information about the job they have applied for (Job Code) is also stored.
Selected Candidates:
This class contains the details of the selected candidates after the Interviewprocess.
Recruited Candidates
This class contains details of the candidates who accepted the offer letters and are
ready to fill the vacancy. This information shall be used to award bonuses to theemployees who referred the candidates.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 12/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
12
PROGRAM 5
Design and implement a student class with the following attributes:
1) Reg No.
2)
Name of the student3) Marks in subject1, subject2, subject3
4) Total Marks
The total of three subject marks must be calculated only when the student pass in all the
subject. The pass marks for each subject is 50. If a candidate fails in any one of the
subjects, his total marks must be declared as 0. Using this condition write a constructer
for this class. Write a method display a student() to display the details of the student of
the object.
a) Identify various use cases and actors involved and represent user view of
the system.
b) Identify various class and attributes and bring out class diagram and
sequence diagram.
Description
In this problem the students interact with the system to see their results. Faculty is the
person who use the software system to enter student’s marks in the system and according
to these marks result is prepared based on the condition that, the total of three subject
marks must be calculated only when the student pass in all the subject. The pass marks
for each subject is 50. If a candidate fails in any one of the subjects, his total marks must
be declared as 0.
Requirement Specification
The system shall accept the marks from the faculty for each student.
The system shall be able to calculate result according to the marks entered and the
condition to declare the result.
Both student and faculty shall see the result.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 13/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
13
Actors and actor documentation
Faculty: It refers to the person who enters the marks and calculates the result.
Student: The student uses the system to view their result.
Use case diagram
marks processing
result processing
<<extends>>
student
display result
faculty
Use case documentation
Marks processing
1. Description: Initiated by the faculty to enter the marks.
2. Precondition: -
3. Normal Flow of Event:
Enter name of the student.
Enter registration number of the student.
Store name and registration number in the database.
Enter marks.
Store marks to the database.
4. Alternate flow of event: -
5. Post condition: -
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 14/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
14
Result Processing
1. Description: Initiated by faculty to evaluate result.
2. Precondition:
3. Normal Flow of Event:
Enter name of the student.
Enter regno of the student.
Search for name and regno from the database.
Retrieve marks from the database and send to the information system.
The total of three subject marks is calculated only when the student pass
in the entire subject. The pass marks for each subject is 50.
4. Alternate flow of event: If a candidate fails in any one of the subjects, his total
marks must be declared as 0.
5. Post condition: Store in the database.
Display result
1. Description: Initiated by both student and faculty.
2. Precondition: -
3. Normal Flow of Event:
Enter name of the student.
Enter registration number of the student.
Search name and registration number from the database.
Retrieve result and send to the information system.
Display result.
4. Alternate flow of event: -
5. Post condition: -
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 15/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
15
Sequence diagrams
1. Sequence diagram for marks processing:-
faculty database
InformationSyste...
1: request for regno and name
2: Enter name and regno
3: Save in database
4: Request for marks
5: Enter marks
6: Save marks
2. Sequence diagram for result processing:
faculty databaseInformation
syste...
1: Request for name and regno
2: Enter name and regno
3: Search for name and regno
4: retrieve marks
5: Provide marks to system
6: Evaluate result and save
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 16/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
16
3. Sequence diagram for displaying result:
student databaseinformation
syste...
1: Enter name and regno
2: Search name and regno
3: retrieve result
4: Send result
5: Display result
Cass diagram
Class Documentation
Student:
Student1 class maintains the attributes of student details such as student name reg_no
marks of the three subjects and total marks of those students who have passed in all
the three subjects and use to view the result and detail of the students.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 17/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
17
Java code
class student
{
int reg_no;
String name;
int marks[ ]=new int[3];
int total;
student(int r,String n,int m[])
{
reg_no=r;
name=n;
for(int i=0;i<3;i++)
marks[i]=m[i];
for(int i=0;i<3;i++)
{
if(marks[i]>50)
total+=marks[i];
else
{
total=0;
break;
}
}
}
void display(){
System.out.println("\nReg no : "+reg_no);
System.out.println("NAME : "+name);
System.out.println("Marks in subject1 : "+marks[0]);
System.out.println("Marks in subject2 : "+marks[1]);
System.out.println("Marks in subject2 : "+marks[1]);
System.out.println("Total marks : "+total+"\n");
}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 18/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
18
public static void main(String s[])
{
int a[]={55,67,89};
int b[]={6,90,90};
int c[]={89,87,67};
student ob1=new s tudent(101,"Manu",a);
student ob2=new student(102,"madhu",b);
student ob3=new s tudent(103,"Raju",c);
ob1.display();
ob2.display();
ob3.display();
}
}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 19/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
19
PROGRAM 6
Problem definition:
Consider the student class defined in Problem 5. Assume that a student studies 6 subjects.
Each subject has a title, passing minimum and maximum marks. Design the classrepresentation using UML notations and write a java program to define student class
including the subject as attribute.Design specifications: A student studies 6 subjects. Each subject has a subject code, title,
passing minimum marks, maximum marks.
The following table shows the sample data:
Subject Code Title Passing Min Max. Marks
CS401 Java 50 100
CS406 ASW lab 18 50
-------- --------- ---- ----You must first define a class called subject. For every student there is an array of 6
subjects. Since all the students study the same subjects, we declare it as static. The studentclass will have the following attributes: Reg_no, name, subject array, marks array, resultarray and total.
a) Identify the various use cases and actors involved and represent the user viewof the system.
b) Identify the various classes and attributes and bring out a class diagram and asequence diagram.
Solution
The purpose of the system is to process marks of individual students in order to determinewhether the particular student has passed or not in the exams and also produce aformatted report of the same.
The following requirements are identified with respect to the system
The system shall process marks of the student. Based on the mark information provided by faculty the total marks of each student
must be obtained along with results. Student result details shall be provided in neatly formatted report for viewing.
While calculating the results the following points are considered
i. A student has to study six subjects, each subject has a passing minimum andmaximum marks.
ii. The total of marks of each student will be calculated only when he/she passes inall the six subjects.
iii. The passing mark in each subject is 50% of the maximum mark.iv. If the candidate fails in any one of the subject the total marks is taken to be zero.
The system must be interactive and suitable user authentication mechanism must
be incorporated.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 20/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
20
Actor Documentation
Actors:
Student: they use the system primarily to check their results.
Faculty: provides the marks of each student for processing the results.
Usecase Diagram:
STUDENT ENTER MARKS
FACULTY
MARKS PROCESSING
<<USES>>
VIEW REPORTS
LOGIN
<<USES>><<USES>>
Usecase documentation:
1 Usecase name: Login
The users of the system either faculty or student interact with the system by going
through a login process to verify their authentication.
Precondition: Each user who wants to use the system must posses a
username & password.Flow Of Events:
1. Request user name.
2. Enter username.3. Request password.
4. Enter password.5. Validate user.6. If valid continue otherwise go to Alternate flow 1.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 21/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
21
Alternate Flow
1: Display error message
2: Reenter username and password.Postcondition: User is allowed or not allowed to login based on the provided username
& password.
2.Usecase name: Marks Processing
Faculty using the system initiates this process. During this stage the total and results of
each student is calculated based on marks entered.Precondition: Valid marks of each student should be present in order to obtain results.Flow Of Events:
1. Request register number of the student for whom marks as tobe entered.
2. Enter register number.3. Validate register number.
4. If valid, perform marks entry process, Otherwise go toAlternate flow 1.
5. Compute total.
6. Compute Result for the student who’s register number hasbeen entered.
Alternate Flow 1: Display Error Message. Request another register number.
Postcondition: Based on the constraints specified and marks, results of eachstudent are provided.
3.Usecase name: Marks Entry
Marks of each student are entered by the faculty during this process. Marks enteredduring this stage are used while calculating results.
Precondition : Marks are needed to calculate result.Flow of Events:
1. Request entry of marks.
2. Enter marks.3. Verify whether entered marks are valid,
If valid continue otherwise Alternate flow 3.Alternate flow 3: Display error message, re-enter marks.Postcondition: Enter marks are verified and are stored to perform processing.
4.Usecase name: Vie w Reports
Students interact with system for the purpose of determining their results. The resultsare presented in the form of reports, for viewing by the students.Precondition: Students specify their Regno. to view results.
Flow of Events:1. Request register number of the student.
2. Enter register number.3. Verify register number.4. if valid display reports of the result otherwise Alternate
flow 4.
Alternate flow 4: Display error message, reenter register number.Postcondition: Result of the student is displayed in a formatted manner.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 22/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
22
Sequence Diagrams:
Sequence diagram for Marks entry and Marks Processing
FacultySystem :
NewInterface
Database
1: Requrest Regester Number
2: Enter Regester Number
3: Verify
4: Found Valid
5: Request Entry Of Marks
6: Enter Marks
7: Verify Entered Marks
8: Update New Marks
9: Transaction Successful
10: View Message
11: Terminate
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 23/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
23
Sequence diagram for Login
User System
2: Enter user name and password
1: Request user name and password
3: Not valid
5: Enter user name and password
4: Request re-entry
6: Valid user
7: Perform operations
Sequence Diagram For Viewing Reports:-
StudentSystem :
NewInterface
Database
1: Request Register Number
2: Register Number Entry
3: Verify
7: View Marks Report
5: Reterive
6: Send Details
4: Found Valid
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 24/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
24
Class Diagram
Class Diagram Documentation
1. Class Name: Student
Student class maintains all the attributes indicating the studentdetails and incorporates the necessary methods required to access
the results, compute results and view reports.
2.
Class Name: Subject
Subject class maintains all the details related to subject studied
by the students, the marks details of each Subject.
3.Class Name: Faculty
Faculty operation details are maintained in this class, they login
to the system to enter the mark details of the students based onthe students register number, once entered the marks details arestored into individual marks array in the student class.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 25/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
25
Program
import java.io.*;
class Subject{
static String sub_name[]={"java","c++","ooad","dbms","ooad lab","java lab"};static String sub_code[]={"Mca51","Mca52","Mca53","Mca54","Mca55","Mca56"};
static int theory_max=100, lab_max=50;static int theory_min=50, lab_min=25;
// attributes are declared static so they can be accessed without inheritance
}
class Marks_details{
int sub1[]=new int [20]; // each array contains the marks details of one particularint sub2[]=new int[20]; // subject, the marks are stored such that each array indexint sub3[]=new int [20]; //corresponds to a students register number
int sub4[]=new int [20];int sub5[]=new int [20];//first 3 arrays store marks in theory next 2 store lab marksint sub6[]=new int [20];
void enter_marks(){
int reg;try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));System.out.println("Enter number of student");
String temp=br.readLine();int n=Integer.parseInt(temp);for(int i=0;i<n;i++)
{ // Each value of i is used as register number
System.out.println("Enter marks for student with register number " +(i+1) );System.out.println("Enter marks in MCA51:");temp=br.readLine();
sub1[i]=Integer.parseInt(temp);System.out.println("Enter marks in MCA52:");
temp=br.readLine();sub2[i]=Integer.parseInt(temp);System.out.println("Enter marks in MCA53:");
temp=br.readLine();sub3[i]=Integer.parseInt(temp);
System.out.println("Enter marks in MCA54:");temp=br.readLine();sub4[i]=Integer.parseInt(temp);
System.out.println("Enter marks in MCA55:");
temp=br.readLine();sub5[i]=Integer.parseInt(temp);
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 26/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
26
System.out.println("Enter marks in MCA56:");
temp=br.readLine();sub6[i]=Integer.parseInt(temp);
}
} catch(Exception e){ }}
}
class Student extends Marks_details{
String Name;
int reg;int marks[]=new int[6];
String subject[] = Subject.sub_name; // accessing static attribute sub_nameint total,t;
String result;
Student()
{reg=-1;total=0;}
int get_details( ){
try{BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Register N umber");String s=b.readLine();
reg=Integer.parseInt(s);System.out.println("Enter Name");Name=b.readLine();
}catch(Exception e){}return (reg);
}
void get_marks()
{marks[0]=sub1[reg-1]; //marks from sub array are stored into marks array
marks[1]=sub2[reg-1]; // the regno value r corresponds to the index inmarks[2]=sub3[reg-1]; // sub array where marks of this regno will be storedmarks[3]=sub4[reg-1];
marks[4]=sub5[reg-1];marks[5]=sub6[reg-1];//array positions marks[4], marks[5] represent lab marks
}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 27/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
27
void compute_result(){
int f1=0, f2=0;for(int i=0;i<6;i++)
{
total=total+marks[i];}
t=total;total=0; //reset total
for(int k=0;k<4;k++){if(marks[k]< Subject.theory_min)
f1=1;}
if(marks[4]<Subject.lab_min || marks[5]<Subject.lab_min)f2=1;
if(f1==0 && f2==0)result="PASS";else
result="FAIL";}
void show_report(){
System.out.println("\n"+"_____________________________" + " StudentMarksDetails"+ " ___________________________" );
System.out.println("\n" + "Name: " +Name +"\n" +"Reg: " +reg);
System.out.println("Sub_code Title Pass_Min Pass_max Marks");for(int i=0;i<6;i++){
if((i!=4)&&(i!=5))System.out.println (Subject.sub_code[i] +" \t\t " +subject[i] + " \t\t "+Subject.theory_min +"\t\t" +Subject.theory_max +"\t" +marks[i]);
else
System.out.println (Subject.sub_code [i] +" \t\t " +subject[i] + " \t "+Subject.lab_min +"\t"+"\t"+Subject.lab_max+"\t"+marks[i]);
} System.out.println("Total: " +t);
System.out.println("Result :" +result+"\n");}
}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 28/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
28
class program6{
public static void main(String args[])
{int ch=0;
Student sob=new Student();try
{do{
System.out.println("Enter Type of user");System.out.println("1. Student");
System.out.println("2. Faculty");System.out.println("3. Exit");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));System.out.println("Enter your choice");String temp=br.readLine();
ch=Integer.parseInt(temp);switch(ch)
{
case 1: int x=sob.get_details();if(sob.sub1[x-1]==0)
{System.out.println("Reg doesnot exist");break;
}sob.get_marks();
sob.compute_result();sob.show_report();break;
case 2:sob.enter_marks();
break;}}
while(ch!=3);}catch(Exception e){ }
}}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 29/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
29
Problem: 7
A class called Television has the following attributes make, screen, size, purchase
date, color/black & white. Define a method for displaying attribute values of a TV.
Represent this following specification using UML class notations and write a javaprogram for the same. Television class should be designed with the required attributes.The main method should be written to test methods of television class. For exampledisplay TV() method may be used to print the attributes of television class.
a) Identify the various use cases and actors involved and represent the user view of thesystem.
b) Identify the various classes and attributes and bring out a class diagram and sequence
diagram.
Requirements
1. The system should be able to display all the kinds of models available according to particular made (Sony, Samsung…).
2. It should be able to show the stock available based on brand, size, color/black & white
ad cost.
3. The user must be authenticated to use the system .
4. The system should be able to display the price list based on the customer
Specification.
Actors
Operator:
He is the actual user of the system. He interacts with the system to perform
transactions such as checking availability of models according to customer specificationand displaying price list according customer request.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 30/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
30
JAVA CODE
class TransactionManager{
String Id="msrit";String password="msrit";
bool Verify(String user,String pass){
return(user.equals("msrit") && pass.equals("msrit"));}
}class Television{
String make,date,type;int size;Television()
{try
{BufferedReader br=new BufferedReader(new InputStreamReader(System.in));System.out.println("Enter the make:");make=br.readLine();System.out.println("Enter the size of T.V.");size=Integer.parseInt(br.readLine());System.out.println("Enter the date of manufacturing:");date=br.readLine();System.out.println("Enter the type");type=br.readLine();
}catch(Exception e) { }
}void display(){System.out.println("Information about the T.V.");System.out.println("--------------------------");System.out.println("Make of T.V.:"+make);System.out.println("Date of Manufacturing:"+date);System.out.println("Type of the TV:"+type);System.out.println("Size of The TV:"+size);
}public static void main(String s[])
{
Television t=new Television();BufferedReader br=new BufferedReader(new InputStreamReader(System.in));String user,pass;TransactionManager tm=new Transactionmanager();System.out.println("Enter userid");user=br.readLine();System.out.println("Enter password");password=br.readLine();
if(tm.verify(user,pass))t.display();
elseSystem.out.println("Invalid userid/password");
}}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 31/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
31
Use cases
Use case name: Display TV models
Description: This use case is initiated by operator. The details are obtained from an
existing database and display different Television models available according toparticular made, screen size...Etc.
Normal flow of events : 1. request for details of T.V .2. request for specific model .
3. enter the specific models.4. display the requested models .
Precondition: The models details must exist in the database.
Post condition: Display the models requested.
Use case name: Authentication:
Description: This use case is initiated by operator of the television system. If an operatorenters his/her details like operator name, password the system validate the operator forusing the system.
Normal flow of events : 1. Request for access.2. Request for Id
3. Enter Id.4. Request for password.5. Enter the password.
6. if invalid password or id, go for alternative flow.Alternative Flow : 1.Display the error message
2. Ask for id and password again.Precondition: Operator information must exist.Post condition: Access to the television system must be granted.
Use case name: View price list
Description: This use case is initiated by operator of the television system. This usecase
displays the price list of the models selected by the customers.Normal flow of events : 1. Request for the price list.
2. Request for the specific model.3. Enter the specific model.4. Display the price list.
Precondition: Prices of all models must exist.Post condition: Price list of the specified model is displayed.
.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 32/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
32
Usecase Diagram
Display Price List
OperatorAuthentication
Display TV Models
<<uses>>
Classes
Television Class:
This class has properties tv make, size, purchase_date,color.Make specifies companies name,size specifies size of the television screen,color
specifies whether the TV is black & white or color.
Methods: TV() is a constructor used to initialize attributes.
Displays() displays the attribute values.Check() verifies whether the made,size is available for the customer.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 33/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
33
Transaction manager:
Transaction manager class is responsible for authenticating the users.It containsattributes such as userid and password.
Methods: verify () verifies whether the user is authorized to the system.
OO Testing
There are several ways object-oriented programming can have an impact on testing.
Depending on the approach to OOP
Some types of faults become less plausible not worth testing for).
Some types of faults become more plausible Worth testing now).
Some new types of faults appear.
When an operation is invoked, it may be hard to tell exactly what code gets exercised.That is, operation may belong to one of many classes. Also, it can be hard to determine
the exact type or class of a parameter. When the code accesses it, it may get anunexpected value. The difference can be understood by considering a conventional
function call.X=func(y);For conventional software, the tester need consider all behaviors attributed to func and
nothing more. In an OO context, the tester must consider the behaviors of base::func(), of devired::func(), and so on.
Sequence diagrams
Authentication:
Operator Television InfoSystem
Request for Access
Request for Id and Password
Enter Id and Password
Acces s Granted
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 34/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
34
Display TV models:
Operator Television InfoSystem
Request for details of TV
Request for Specific Made
Enter Specific Made
Display Model
Display price list
Operator Television Info
System
Request for Price List
Request for Specific Model
Enter the Model
Display Pricelist
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 35/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
35
Program 8
Bank Interest Computation
Consider the following attributes:
P : Principle AmountR : Rate Of Interest
N : Number Of YearsSI : Simple Interest
A : Amount
Requirement S pecification:
Customer deposits money in the bank. The deposited money is called thePrinciple Amount.
After authentication and verification of the user, the principle amount and interest
is computed and the amount is displayed. The time in years varies for RD, FD, SB account types and interest is computed
based on the following factors: - Account Type: RD, FD, and SB. Time duration: Monthly, quarterly, half yearly and annually.
Minimum Balance: 5000/- SB10,000/- FD
10,000/- RD
Actors:
Account Holder
DBMS Administrator
Actor Documentation:
Account Holder: He or She will have an account in the bank and would beallowed to access the details of their account.
DBMS: It will contain the account holder details. It will display the requestedinformation.
Administrator: He will authorize the access to the account and if verified willprovide the account details. He will authenticate, validate, compute, update theinterest rates and store the computed results and account holder details in DBMS.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 36/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
36
USE CASE :
Deposit
Display
AccountHolder
Calculate Interest
DBMS
Verify Account
Administrator
Use Case documentation:
Verify Account: This use case is initiated by the Account Holder, Account Holderenters the PIN number.This would be cheked by the administrator fro its existence
and correctness and will authenticate the user fro further use of the system.
Deposit Amount: This use case is initiated by the account holder. The accountholder will deposit the money using the cheques.
Calculate Interest: This use case is initiated by the Administrator after theauthentication of details provided by the account holder. It will then calculate the
interest amount according to the factors mentioned in the requirementsspecification and according to the formulae:
SI = ( P * R *N ) / 100
Amount = P + SIWhere
P : Principle AmountR : Rate Of Interest
N : N umber Of YearsSI : Simple Interest
A : Amount
Display Output: This use case is initiated by the DBMS. It will display theaccount holders’ information on the screen after the processing has been done by
the administrator.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 37/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
37
Flow of events:
Verify Account :
Pre-condition:
The Account Holder should have a PIN number.Normal Flow:
1. Requested for the PIN number.2. Enters the PIN number. If invalid alternate flow 1
3. The Administrator checks with the Database if the requested PIN numberexists. If it is invalid go to Alternate Flow 2.
4. If valid, it will ask the account holder to deposit money.
Alternate Flow 1:
Requested pin number again.
Alternate Flow 2:1. Request the user to enter valid PIN. Go to Normal Flow 2.
2. If again invalid PIN then come out of the transaction.
Post-Condition:
The PIN number is validated and the user is requested to start the required
transaction.
Deposit Money:
Pre-Condition:The account is validated.
Normal Flow:
1. Enter the cheque number.2. Enter the branch.
3. Enter the Amount.4. If cheque is valid, balance is updated.5. If invalid, go to Alternate Flow 1.
Alternate Flow:
1. Balance remains unchanged.
Post-Condition:
The amount is deposited to the respective account type and balance is updated.
Calculate Interest:
Pre-Condition:
The minimum balance should be there.
Normal Flow:1. Enter the account type.
2. Enter the principle amount.3. Enter the rate of interest.4. Enter the number of years.
5. If it is less than minimum balance go to Alternate Flow 1.
6. Calculate the Simple Interest according to the formulae:
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 38/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
38
SI = ( P * R * N ) / 100Amount = P + SI
Where
P: Principle Amount
R: Rate Of InterestN: Number Of Years
A: AmountSI: Simple Interest
a. The interest is computed and the balance is updated.
Alternate Flow:
1. Display “ No minimum balance” Post-Condition:
The Simple Interest is calculated and balance is updated.
Display Output:
Normal Flow:
1. The updated current balance is displayed on the screen by theDBMS to the user.
Alternate Flow:
No Alternate Flow.Post-Condition:
The Transaction is successful and completed.
CLASS DIAGRAM
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 39/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
39
Class Documentation :
Account Holder - Account holder class will have the essentials details of the account
holder. The details are Account holder’s name, address, phone number, the account
number which will be an unique number for each account holder, Pin number. The pinnumber is known to the account holder.
Administrator - Administrator class will have the details of account holder number,
Account holder name and the Rate of interest needed to calculate the Simple Interest .The account number is used by the administrator for verifying the account ho lder.
Deposit - Deposit is a class which will have the details of the principle amount of theaccount holder, Rate of Interest, the time in number of years. The Simple Interest is going
to be added to the principle and will be known as the amount.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 40/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
40
Java code
import java.io.*;import java.lang.*;
class AccountHolder{
String name;int accno;
float balance;
void GetDetails()
{try
{BufferedReader BR = new BufferedReader( new
InputStreamReader(System.in));
System.out.println("Enter Name ... :");
name = BR.readLine();
System.out.println("Entet Account No ... :");
accno = Integer.parseInt(BR.readLine());
System.out.println("Enter Main Balance ... : ");balance = Float.parseFloat(BR.readLine());
}catch(Exception e){
System.out.println(e);}
}
void ShowDetails()
{System.out.println(" Account Holder Name : " + name);System.out.println(" Account Number : " + accno);
System.out.println(" Account Balance : " + balance);}
}
class Deposite extends AccountHolder
{float DepositeAmount;
float Rate;float SimpleInterest;int Year;
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 41/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
41
void CalculateInterest(){
try{
BufferedReader BR = new BufferedReader( new
InputStreamReader(System.in));
System.out.println("Enter Amount To Be Deposited ... ");DepositeAmount = Float.parseFloat(BR.readLine());
System.out.println("Enter No. o f Years ... ");Year = Integer.parseInt(BR.readLine());
System.out.println("Enter Rate of Interest ... ");
Rate = Float.parseFloat(BR.readLine());
balance = balance + DepositeAmount;
System.out.println(" Account Balance after Deposit : " + balance);
SimpleInterest = ((balance * Rate * Year)/100);
balance = balance + SimpleInterest;}
catch(Exception e){
System.out.println(e);
}}
void ShowAmount(){
System.out.println(" Deposited Amount : " + DepositeAmount);
System.out.println(" Simple Interest : " + SimpleInterest);System.out.println(" Updated Balance : " + balance);
}
}
class CalculateInterest{public static void main(String args[])
{Deposite D1 = new Deposite();
D1.GetDetails();D1.ShowDetails();D1.CalculateInterest();
D1.ShowAmount();
}}
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 42/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
42
9. OOA AND OOD USING RAUMBHAG AND UML VI
In a bank the customer opens an account and in that account he/she deposits
money. So the entities are:
A customer can have several accounts and several customers can spend an account
as a joint account. In the customer class, the address of the customer is constructed as anobject of a class called Address. Write the UML class diagram consisting customer class
and address class. In the account class there is an attribute called users. This is an integerattribute. It tells number of users of the account. If the account is a joint account by 5persons, the value of users =5 persons, the value of users=5. If it is a single user account,
users=1.
Write the UML class diagram for account:The account number is long type. Cust () is an array of length=users. If the
users=5, cust () is of length 5. Another attribute of the account is an object of depositclass. Write the UML class diagram for deposit.
TEST CASE:
Objectname
User ID Fname Uname DOB ADD Phone no
Address
Objectname
Street City State Country Pin code
Deposit:
Principle p=No. of years n=
Rate of interest=Account:
Account object: a1A/c No:Customer object:
No. of users:Deposit object: d1
Sample Output:A/c No:Customer ID:
First name:Last name:
DOB:
Address:Phones:
CUSTOMER DEPOSITACCOUNT
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 43/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
43
Customer ID: First name:
Last name:DOB:
Address:
Phones:
No of users:
Deposit:
Principle:Rate of interest:No of years:
Simple interest:Amount:
Problem Statement:
In a bank customer opens a account and in that account he/she deposits money.
Customers have several accounts.
Several customers can use an account as joint account.
The above two conditions should be differentiated and the number of users of those account should be indicated.
Write UML class diagram consisting customer class and address class. In accountclass there is an attribute called user of integer type. This tells the number of
users.
If the joint account is by 5 persons the value of users =5.If it is a single user account then user=1.
Write UML class diagram for account.
The account number is of long type
Cust () is an array of length users. If user=5 then cust() is of length 5.
Another attribute of account is an object of deposit class.
Write UML diagram for deposit.
Requirements:
1 The bank client must be able to deposit amount into his/her account.
2 Recorded transaction must include date, time, amount and account balance aftertransaction.
3 Customers can have more than one account.
4 The bank application operates for single banking institutions only.5 Client’s deposits money called principle amount into the bank and specify the
amount to be deposited for number of years based on that the rate of interest iscalculated.
6 The system must be able to get number of customers at any time.
7 The system must provide security.8 There are three types of accounts they are savings, current and joint.
9
More than one customer can share account.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 44/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
44
IDENTIFICATION OF ACTORS:
Actors:
1) Clerk
2) BIS
ACTOR DOCUMENTATION:
Clerk:
This actor is responsible for processing the client request, authentication andcarrying out the transactions of the client.
BIS:
This actor is responsible for holding the details of various transaction of the client.
USE CASE DIAGRAM:
Clerk BIS
Deposit Money
Interest Calculation
USE CASE DOCUMENTATION:
(1)
USE CASE NAME : DEPOSIT MONEY
DESCRIPTION This use case is initiated by bank clerk
Bank client deposits money (cash) at random time.Under the account type we have Joint, Saving andcurrent
PRE-CONDITION Verification and validation of account number,user id authenticated by clerk through BIS.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 45/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
45
NORMAL FLOW 1.Enter account number2.Valid account number
3.Enter customer id.4.Valid customer id.
5.Enter amount for deposit (cash).
ALTERNATIVE FLOW Not authenticated.POST CONDITION Update of transaction.
(2)
USE CASE NAME : INTEREST CALCULATIONDESCRIPTION This use case is initiated by bank clerk. It
calculates the simple interest and updates thebalance amount.
PRE-CONDITION Verification and validation of account number,user id authenticated by clerk through BIS.
NORMAL FLOW Calculation of simple interest.ALTERNATIVE FLOW Not authenticated.POST CONDITION Update Balance.
CLASS DIAGRAM :
Analysis Phase:
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 46/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
46
Design Phase:
Class Diagram Description
Class Customer:
This class contains the customer’s personal details like customer identification number,
name of the account holder, his address and date of birth. It will display the customer’s
details on request.
Class Account:
This class contains the account details of the customer like account number, if it is a joint
account then the number of users, date of opening the account and the amount deposited.
This displays the number of users and the amount deposited on request.
Class Address :
This class contains the address details of the customer where is location is recorded as a
proof of existence. This displays the address details of the account holder on request.
Class Deposit :
This class contains the deposit details of the customer with respect to a particular account.
Here we calculate the simple interest based on the principal, number of years deposited
since the last time and interest, which is fixed by the bank. This displays the bank interest
calculated on a particular account.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 47/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
47
Problem No: 10
Consider the object college of mini project for the entire given specification in the
problem construct following UML diagrams.
Specification: In a college of CS there are computer laboratories and equipments.
Develop a system to create the college as an object and display contents.
1. Class Diagram
2. Object Diagram
3. Interaction Diagram
a) Sequence Diagram
b) Collaboration Diagram
4. Deployment Diagram
Requirements:
The system shall display the equipment details of the computer laboratory
of college. The maintenance person shall update the details of the laboratory
equipments in college. The user shall be allowed to view the details of equipments in college.
Actors:
1. Lab User
2. Maintenance Person3. Database
Actor Documentation:
1. Lab User: User is an actor who views the details of the laboratoryequipments.
2. Maintenance person: Maintenance person is an actor who updates theinformation about the equipments.
3. Database: Database is an actor, which contains the details of laboratoryequipments.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 48/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
48
Use Case Diagram:
Authentication
Maintenanceperson
User
Update
<<uses>>
Database
View detai ls
Use Case Documentation:
Authenticate: The maintenance person initiates this Use case. The maintenance personenters the login id and password. If the login id and password are valid the maintenance
person is allowed to update information and view the database.Flow of events:
1. Request ID2. Request Password3. Enter ID
4. Enter Password5. Verify ID invalid go to alternate flow
6. Verify Password invalid go to alternate flowAlternate Flow:
1. Request ID
2. Request Password
3. Enter ID4. Enter Password5. Verify ID6. Verify Password
Precondition:
The maintenance person shall be provided with a login-id and password.
Post condition:The valid user is allowed to update the information.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 49/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
49
Update: This Use case is initiated by the maintenance person. The maintenance person isallowed to update the database.
Flow of events:
1. Request for details
2. Enter name and description
3. Update databasePrecondition:
The database has to be created.Post condition:
The details has to be stored into the database.
View details : This Use case is initiated by general user. User is allowed to view the
details of the lab.Flow of events:
1. Request lab details display form2. Show form
Precondition :The equipment details has to be present in the database.
Post condition:
The equipment details is displayed by the system
Sequence diagrams:
1. Sequence diagram for authentication:
Maintenanceperson
: loginFormDatabase
1: Enter id and password
2: Verify
3: Veri fication
4: V alid user
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 50/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
50
2. Sequence diagram for Update:
Maintenanceperson
Database
3: verification
: maintenanceForm1: Enter id & password
2: Verify
4: Valid User
5: Request details
6: Enter details
7: Update details
3. Sequence diagram for View details:
User Database
3: Retrieve
: viewdetailsForm
1: Request details
4: Send details
5: Display details
2: Check database
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 51/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
51
Collaboration diagrams:
1. Collaboration diagram for Authentication:
User
Database
3: Retrieve
: viewdetailsForm
1: Request details
5: Display details
4: Send details
2: Check database
2. Collaboration diagram for Update:
Database
Maintenanceperson
3: verification
: maintenanceForm6: Enter details
1: Enter id & password
5: Request details
7: Update details2: Verify
4: Valid User
3. Collaboration diagram for View details:
User
Database
3: Retrieve
: viewdetailsForm
1: Request details
5: Display details
4: Send details
2: Check database
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 52/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
52
Class diagram:
Class diagram documentation:
The various classes involved here are:1. Software class
2. Lab class3. Peripherals class
4. Equipments class
Software Class: The attributes here are license, No of copies and validity.
Lab Class: The attr ibutes here are Lab- id, which is meant for identification of labs.Peripherals Class: The attributes here are Make and Type.
Equipment Class: The attributes here are Equipment-Id, Purchase-date and Warranty.
Deployment diagram:
DatabaseServer
Client Machine
LAN
Deployment diagram documentation:
Database will be stored in the server and will be accessed by the user through LAN.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 53/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
53
Program11:
C Library Information System
Problem Statement:
A Library lends books and magazines to member, who is registered in the system. Also it
handles the purchase of new titles for the Library. Popular titles are bought into multiplescopies. Old books and magazines are removed when they are out or date or in poor
condition. A member can reserve a book or magazine that is not currently available in thelibrary, so that when it is returned or purchased by the library, that person is notified. Thelibrary can easily create, replace and delete information about the tiles, members, loans
and reservation in the system.
Requirement Specification
The Library System offers the following Services:
Issuing of Books and Magazines to member who are registered in the system.
It handles the purchase of new titles for library. Popular titles are bought in
multiple copies.
Old books and magazines are removed when they are out of date or in poor
condition.
If a member asks for a book/magazines then
o The book is issued if availableo Otherwise, it is reserved for that member so that he can get the book when
book is available.
It shall provide the loan for purchasing book for studentIt shall provide a way to create, replace and delete information about book titles,member, loans and reservation in the system.
Use-case Documentation
1) Notify: The librarian initiates this use case when any member returns the book and checking if the book is already reserved.
Precondition: The member should return Book.Normal Flow: Build message for member who reserved the book.
Post Condition: Send message to respective member who reserved the book.
2) Borrow Book: Initiated by librarian when any member wants to borrow the
desired book. If the book is available, the book is issued.
Precondition: Member should be valid member of library.Normal Flow: Selected book will be issued to the member.Alternative Flow: If book is not available then reserved book use case should be
initiate.Post Condition: Update the catalogue.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 54/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
54
3) Reserve Book: Initiated by librarian when the requested book is not available in
the library at that moment. The book is reserved for the future and issued to theperson when it is available.
Precondition: Initiated only when book is not available.Normal Flow: It reserved the book if requested.
Post Condition : Mention the entry in catalogue for reservation.
4) Return Books: Invoked by the librarian when a member returns the book.
Precondition: Member should be valid member of library.
Normal Flow: Librarian enters bookid and system checks for return date of thebook.
Alternative Flow: System checks for return date and if it returned late finemessage will be displayed.
Post Condition: check the status of reservation.
5) Check library card: The borrow and return use-cases use it to check the validity
of the user-card.
Normal Flow: Enter the memberid.
Alternative Flow: system will going to validate the member and if member is notvalid message will be supplied.
Post Condition: Then depending upon the transaction (i.e. borrow or return book)system will initiate corresponding operation.
6) Add Books: The purchase book use-case when new books invoke it or magazinesare added to the library.
Precondition: Not available or more copies are required.Normal Flow: Enter bookid and no of copies.
Post Condition: Update the information in catalogue.
7) Remove Book: Initiated by the Library Inventory Manager when old anddamaged books are removed from the library.
Precondition: Books are in the outdated condition.Normal Flow: Remove the book from library.
Post Condition: Update the catalogue.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 55/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
55
Remove Book
Notify
Return Book
Check Library Card
<<Uses>>
LIBRARIAN
Borrow Books & Magzines
<<Uses>>
Reserve Books
<<extend>>
USE CASE DIAGRAM FOR LIBRARY
LIBRARYINVENT...
Add Book
Actor Documentation
1) Librarian: The Librarian is a person who is responsible for maintaining,issuing/renewal and reserving of the books. This person also verifies the user’s
library card before issuing, renewing, reserving or accepting a book whenreturned.
2) Library Inventory Manager: He/she is responsible for maintaining the librarydatabase by adding and removing the books and their related details as required.
He/she is also responsible for placing orders with the supplier and updating thedatabase according to the corresponding changes made.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 56/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
56
Lib Inventory
Manager
Lib Info
System
Sequence diagram for removing book
1: Query For Outdated / Damaged Books
2: Check for damage
3: display damaged book_id
4: Delete
Lib InventoryManager
Lib InfoSystem
Collobration diagram for removing the book
2: Check for damage4: Delete
1: Query For Outdated / Damaged Books
3: display damaged book_id
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 57/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
57
Librarian Lib InfoSystem
SEQUENCE DIAGRAM FOR BORROWING BOOKS
1: Verify Id
2: Get File
3: Valid User
4: Get book_id
5: Update
6: Issue Book
Librarian
Lib InfoSystem
2: Get File5: Update
Collobration diagram for borrowing the book
1: Verify Id4: Get book_id
3: Valid User6: Issue Book
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 58/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
58
Librarian Lib InfoSystem
1: Verify Id
DIAGRAM FOR RESERVE BOOKS
2: Get File
3: Valid User
4: Get book_id
5: C heck for avai labi li ty
6: Display Unavailable
7: request for reserve book
8: Reserve
Librarian
Lib InfoSystem
2: Get File5: Check for availability
COLLOBRATION DIAGRAM FOR RESERVE
8: Reserve
1: Verify Id4: Get book_id
7: request for reserve book
3: Valid User6: Display Unavai lable
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 59/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
59
Librarian Lib InfoSystem
Sequence diagram for return books /Notify
1: Verify Id
2: Get File
3: Valid User
4: Enter book_id
5: Check for return date
6: Display fine(late return)
7: Check for reservation
8: Notify if reserve
Librarian
Lib InfoSystem
2: Get File5: Check for return date
COLLOBRATION DIAGRAM FOR RETURNING BOOKS
7: Check for reservation
1: Verify Id4: Enter book_id
3: Valid User6: Display fine(late return)
8: Notify if reserve
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 60/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
60
Activity diagram for library
Verify Id
Enterbook_id
Issue Bookand Update
[ Borrow book ]
BookAvailable
[ Yes ]
Not a ValidUser
ReserveBook
[ No ]
[ invalid ][ Valid Member ]
Book_id[ Return book ]
Update &check
for fine
Check forreserve
Class Diagram
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 61/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
61
Class Documentation
1) Catalogue: It is main class contains all details about books and magazines and
made up of two sub class Book and Magazines i.e. Aggregation relationship
2) Book: It is sub class of catalogue it uses the method such as
Add(),Delete(),Search(),Display() of catalogue class and it also have one attributeIsbn and contains one method Condition() which show the condition of book for
removing purpose.
3) Magazines: Is is also sub class of catalogue it also uses all the method of
catalogue class and contains one attributes Type which describes the type of magazines.
4) Transaction: Its main class contains the inheritance relationship with Borrow and
Return book.
5) Borrow Book: Contains details about the borrow book that is which member
Borrow particular book and its return date.
6) Member: Contains all the information about member such as name,address,
The no. of book particular member has etc.
Component Diagram
Transaction Member
Catalogue
Transaction: This Component consists of Borrow, Return class.
Member: This component consists Member class
Catalogue: This component consists of Book and Magazines Class.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 62/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
62
Program-12:
Develop the product using java programming language. Write UML
diagram for Railway Reservation System.
Requirement specification
The Automated Railway Reservation System offers the following services:
It is a software used by Railway reservation staff.
It shall provide train schedules and information
It shall provide availability of seats on given dates and given train names
To provide information about category (classes) of tickets like A/C, I class ,II
class, II class sleeper coach Customers/passenger to fill the reservation form manually and give it to the
concerned railway staff.
After processing the customer/passenger information, the staff will verify
availability of the tickets. If it is available the customer/passenger has to pay the
ticket amount by cash to the railway staff. After the amount is paid the staff issues
the ticket to the passenger. Here we assume that no Waiting list ,RAC, tathkal
tickets are issued , Cancellation of tickets are also not available.
Updating information and availability of tickets taken care by by the railway staff
Use case diagram:
Railway Reservation System
Database
Railway
Reservation staff
Processing Reservation form
issuing of tickets
Train Information
updating information anddisplay availabi lity of tickets
<<uses>>
<<extends>>
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 63/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
63
Actors:
Railway Reservation Staff
Database
Description of Actors:
Railway Reservation Staff: He /she is responsible for processing the passenger’s request like checking the
availability of trains, booking the tickets and issuing of tickets.
Database:
It is used to store, access and keep the updated records of reservation andinformation about passenger, and trains. Database keeps track of the seats availability of respective trains on respective dates.
Use Case Description
1. Train Information:
Description of use case:
The railway staff enters train information like train no., train name, date of
journey, source and destination station. It checks the source and destination of trains andtimings of train.Normal flow of events:
1. Enter the source station2. Enter the destination station
3. Enter the Train no.4. Enter the Train name.
Post condition: select the train to journey.
2. Availability Of Ticket:
Description of use case:
The staff initiates this use case. For this the passenger is requested to fill aprescribed form containing details of train no., train name, date of journey, source anddestination station, class, then it check if the required seat is available or not.
Pre condition: The customer will fill the required form and give it to the concernedstaff.
Normal flow of events:
1. Enter the source station.
2. Enter the destination station.3. Enter the class of coach.4. Enter the date of journey.
5.Enter the train no.6.Enter the train name
7. If the reservation is available, display the details.Otherwise go to Alternative flow1.
Alternative Flow 1: Display that the reservation is not available.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 64/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
64
3. Process ing Reservation Information:
Description of use case:
The passenger is required to enter the train no., train name, date of journey, source
and destination station, class, and no. Of seats, name, age, sex, address. Fill the requiredinformation of ticket along with personal information.
Pre-condition: Seats should be available.Normal flow of event :
1. Enter the train name and train no.
2. Enter the source station.3. Enter the destination station.
4. Enter the date of journey.5. Enter the class of coach.6 . Enter the Name.
7 . Enter the Age.
8 . Enter the Sex9. Enter the address
10.Verify the details. If valid details pay the requiredamount in cash otherwise Alternative flow 1
Alternative Flow 1: Display the details to re-enter the missed details.
Post-condition: The customer will be issued the ticket.
4. Issuing ticket:
Description of use case:
This is an extended use case of processing of reservation information. After thepassenger details are correct the ticket will be given printed form
Pre-condition: Amount must be paid in cash to railway staff
Normal flow of event:
1. Check the details of passenger.2. Give print message to the printer.
3. The ticket is issued.4. Database is updated.
Post Condition: The ticket is issued and is collected by the passenger.
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 65/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
65
Sequence diagram of train information
railway staff form database printer
1: enter the source station 2: enter the destination station
3: enter the train no.
4: enter the train name 5: submit the details
6: process the info
7: display the train info
Collaboration diagram of train information
railwaystaff
form
database
printer
6: process the info
1: enter the source station2: enter the destination station
3: enter the train no.4: enter the train name
5: submit the details
7: display the train info
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 66/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
66
Activity diagram of train information
enter the source
station
enter the destination
station
enter the train
no.
enter the train
name
incorrect info
display train
information
correct info
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 67/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
67
Sequence diagram of availability of ticket
railway staff form database printer
1: enter the source station
2: enter the destination station
3: enter the class of coach
4: enter the date of journey
5: enter the train no.
6: enter the train name
7: submit the i nfo
8: process the info
9: display the availability
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 68/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
68
Collaboration diagram of availability of ticket
railway
staff
form
database printer
1: enter the source stat ion2: enter the destination station
3: enter the class of coach4: enter the date of journey
5: enter the train no.6: enter the train name
7: submit the info
8: process the info
9: display the availability
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 69/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
69
Activity diagram of availability of tickets
enter the source
station
enter the destination
station
enter class of
coach
enter the date of
journey
enter the train
no.
enter the train
name
display available
reservation available
display not
available
reservation not available
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 70/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
70
Sequence diagram of processing reservation for
railway staff form database printer
1: enter the train no.
2: enter the train name
3: enter the source stat ion
4: enter the destination station
5: enter the date of journey
6: enter the class of coach
7: enter the name
8: enter the age
9: enter the sex
10: enter the address
11: submit t he info
12: process the info
13: display the amount to be paid
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 71/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
71
Collaboration diagram of processing reservation form
railwaystaff
form
database
printer
1: enter the train no.2: enter the train name
3: enter the source station
4: enter the destination station5: enter the date of journey6: enter the class of coach
7: enter the name8: enter the age9: enter the sex
10: enter the address
11: submit the info12: process the info
13: display the amount to be paid
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 72/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
72
Sequence diagram of issuing ticket
railway staff form database printer
1: enter the passenger details
2: submit the form
3: check the passenger details
4: display invalid details
5: reenter the details
6: submit the form
7: proc ess the info
8: print the ticket
9: update the dat abase
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 73/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
73
Collaboration diagram of issuing ticket
railwaystaff
form
database printer
1: enter the passenger details
2: submit the form
3: check the passenger details4: display invalid details
5: reenter the details
6: submit the form
7: process the info
8: print the ticket
9: update the database
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 74/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
74
Activity diagram of issuing ticket
enter the trainno.
enter the sourcestation
enter thedestination station
enter the date of journey
enter the classof coach
enter the no. ofpassengers
enter thetrain name
enter name
enter age
enter sex
enteraddress
print ticket
incorrect details
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 75/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
75
Class diagram:
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 76/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
76
Java code
import java.io.*;
class Passenger
{String name;
int age;String sex;
String Address;
}
class Train{
int Train_no;String Train_name;
}class Form{
Passenger pr =new Passenger();Train tr= new Train();String Source_Station;
String Destination_Station;String Date_of_journey;
int No_of_pass;String Class_of_coach;int i;
void get_pass_details()
{try{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));System.out.println("No_of_pass:");
No_of_pass=Integer.parseInt(br.readLine());System.out.println("Name:");pr.name=br.readLine();
System.out.println("Age:");pr.age=Integer.parseInt(br.readLine());
System.out.println("Sex:");pr.sex=br.readLine();System.out.println("Address:");
pr.Address=br.readLine();get_train_details();
}catch(Exception e) {}
}
void get_train_details()
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 77/78
Downloaded from www.pencilji.com
Downloaded from www.pencilji.com
77
{try
{BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Train Number:");tr.Train_no=Integer.parseInt(br.readLine());
System.out.println("Train Name:");tr.Train_name=br.readLine();
System.out.println("Source_Station:");Source_Station=br.readLine();System.out.println("Destination_Station:");
Destination_Station=br.readLine();System.out.println("Date_of_journey:");
Date_of_journey=br.readLine();System.out.println("Class_of_coach:");
Class_of_coach=br.readLine();
}
catch(Exception e) {}
}
}
class Ticket extends Form{
Train tr = new Train();
int ticket_no;String Source_Station;String Destination_Station;
String Departure_Time;int amount;
int calc_fare(){
return 0;
}
void print_ticket(){
ticket_no=0;
ticket_no++;try
{System.out.println(" ");System.out.println("-------------------------------------------------- ");
System.out.println("Train Number : "+tr.Train_no);
System.out.println("Train Name : "+tr.Train_name);System.out.println("Ticket Number : "+ticket_no);
8/8/2019 88020750
http://slidepdf.com/reader/full/88020750 78/78
Downloaded from www.pencilji.com
System.out.print("Source Station : "+Source_Station);System.out.print("\t To \t");
System.out.println("Destination_Station : "+Destination_Station);System.out.println("Date_of_journey : "+Date_of_journey);
System.out.println("No_of_pass : "+No_of_pass);
System.out.println("Amount : ******");System.out.println("---------------------------------------------------");
System.out.println(" ");}
catch(Exception e){}
}
}
class railway
{public static void main(String args[]){
try{
Ticket tk= new Ticket();tk.get_pass_details();
tk.print_ticket();
}catch(Exception e)
{System.out.println("Error");
}
}}