Professional Documents
Culture Documents
Problem definition
In employee referral process, the HR head of the region where a vacancy exists
informs 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. The
employees 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 the
skills required for the vacant position and shortlist them. An interview schedule is drawn
up 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. The
candidate informs the HR (head where the vacancy exists) either by accepting or
declining the offer letter. When a candidate referred by an employee joins the
organization, 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 the
system.
b) Identify the various classes and attributes and bring out a class diagram, and a
sequence diagram.
1
Use-Case Diagram:
Notify Vacancy
<<Uses>>
HR Head
Selection of Eligible
Candidates
<<Extends>> Em ployee
A ward B onus
2
Sequence Diagram:
Notify Vacancy:
Email
: HR Head
System : Employee
1: Informs about Vacancy
2.Recieves Vacancy
Information
Online Form IS
: Employee
: HRHead
1: Refers Candidate
2: Upload Details
3: Refers Candidate
4: Upload Details
3
Selection of Candidates:
Online Interview IS
: HR Head System : Candidate
1: Initiate Interview
3: Receives reply
4
Intimation [Accepts Offer Letter]:
Email
: HRHead System : Candidate : Employee
3: AcceptsOffer Letter
4: Recieves Acceptance
5: Informsabout bonusawarded
6: RecievesBonusNotification
Intimation [Rejection]:
Email : Candidate
: HRHead System
5
CLASS DIAGRAM
Employee
Fname : String
LName : String
Emp-ID : int
Designation : String
region : string
ReferCandidate()
GetBonus() Maintainence
H R Hea d Employee e
Employee e Candidate c
Candidate c
Insert()
InformVacancy() Update()
ConductInteview() Delete()
ShortList Candidates()
Intimate Candidates()
Vacany Details
JobCode : int
Designati on : St ri ng
Descri pti on : S tring
Candidate
No. ofVacant Pos : i nt
Fname : String
Prerequi sit s() LName : string
CandidateID : int
JobCode : int
apply()
6
PROGRAM 5
Design and implement a student class with the following attributes:
1) Reg No.
2) Name of the student
3) 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.
marks processing
<<extends>>
student faculty
result processing
display result
7
Sequence diagrams
1. Sequence diagram for marks processing:-
faculty database
Information
Syste...
3: Save in database
5: Enter marks
6: Save marks
8
2.Sequence diagram for result processing:
faculty database
Information
syste...
4: retrieve marks
student database
information
syste...
3: retrieve result
4: Send result
5: Display result
9
Cass diagram
student
Sname
Regno
Marks1
Marks2
Marks3
Total
Student.S[3]
student ()
display()
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;
10
}
}
}
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");
}
public static void main(String s[])
{
int a[]={55,67,89};
int b[]={6,90,90};
int c[]={89,87,67};
student ob1=new student(101,"Manu",a);
student ob2=new student(102,"madhu",b);
student ob3=new student(103,"Raju",c);
ob1.display();
ob2.display();
ob3.display();
}
}
11
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 class
representation 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.
12
Usecase Diagram:
LOGIN
FACULTY
<<USES>>
13
Sequence Diagrams:
Faculty Database
System :
NewInterface
1: Requrest Regester Number
3: Verify
4: Found Valid
6: Enter Marks
7: Verify Entered Marks
9: Transaction Successful
11: Terminate
14
Sequence diagram for Login
User System
3: Not valid
4: Request re-entry
6: Valid user
7: Perform operations
Student Database
System:
NewInterface
1: Request Register Number
3: Verify
4: Found Valid
5: Reterive
6: Send Details
7: View Marks Report
15
Class Diagram
S ub ject
Sub _name : S trin g
Sub _c ode : St ri ng
theor y _m ax : Inte ger
theor y _m in : Int eger
lab_m ax : Int eger
lab_m in : Integ er
D e rives S ub je ct In fo
D erives S ub je ct Info
S tude nt
Regno : Integer F a culty
Nam e : S tring s ub 1[] : Intege r
M ark s [] : Integer s ub 2[] : Intege r
S ubjec t[] : S tring s ub 3[] : Intege r
total : Integer P ro vi de s M a rks de ta il ss ub 4[] : Intege r
res ult : S tring s ub 5[] : Intege r
s ub 6[] : Intege r
s tudent_login()
get_details () fac ulty _login()
get_m ark s () get_re gno()
c om pute_res ult() enter_ mark s ()
view_reports ()
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 particular
int sub2[]=new int[20]; // subject, the marks are stored such that each array index
int sub3[]=new int [20]; //corresponds to a students register number
16
int sub4[]=new int [20];
int sub5[]=new int [20];//first 3 arrays store marks in theory next 2 store lab marks
int 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);
Student()
17
{
reg=-1;total=0;}
int get_details( )
{
try
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Register Number");
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 in
marks[2]=sub3[reg-1]; // sub array where marks of this regno will be stored
marks[3]=sub4[reg-1];
marks[4]=sub5[reg-1];
marks[5]=sub6[reg-1];//array positions marks[4], marks[5] represent lab marks
}
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
18
result="FAIL";
}
void show_report()
{
System.out.println("\n"+"_____________________________" + " Student
MarksDetails"+ " ___________________________" );
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
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();
19
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){ }
}
}
20
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 java
program 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 example
display 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 the
system.
b) Identify the various classes and attributes and bring out a class diagram and sequence
diagram.
Use cases
21
.
Usecase Diagram
Display TV Models
<<uses>>
Operator
Authentication
Classes
Transaction Manager
TV
id : char
make : char <----- password : char
size : char
purchase_date : int verify()
color : bool
TV()
Display()
Check()
22
Sequence diagrams
Authentication:
Access Granted
Display TV models:
Display Model
23
Display price list
Display Pricelist
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");
24
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();
else
System.out.println("Invalid userid/password");
}
}
25
Program-8
USE CASE :
VerifyAccount
Deposit Administrator
Account
Holder
Calculate Interest
DBMS
Display
26
CLASS DIAGRAM
A c c o u n t H o ld e r A d m i n i s tr a t o r
Nam e A c c o u n t H o ld e r N u m b e r
A d d re s s A c c o u n t H o ld e r N a m e
Phone Am o u n t
Acco u n t N u m b e r R a te o f I n te r e s t
P in N u m b e r
V a li d a te U s e r( )
E n te r P i n ( ) C a l c u l a t e In t e r e s t( )
D e p o s i t( ) D i s p l a y O u tp u t( )
D e p o s it
P r in c ip le
R a te o f I n te r e s t
N u m b e r o f ye a r s
S i m p l e I n te r e s t
Am o u nt
D e p o s i t( )
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));
27
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);
}
}
void CalculateInterest()
{
try
{
BufferedReader BR = new BufferedReader( new
InputStreamReader(System.in));
28
catch(Exception e)
{
System.out.println(e);
}
}
void ShowAmount()
{
class CalculateInterest
{
public static void main(String args[])
{
Deposite D1 = new Deposite();
D1.GetDetails();
D1.ShowDetails();
D1.CalculateInterest();
D1.ShowAmount();
}
}
29