0% found this document useful (1 vote)
280 views7 pages

Candidate Management System

The document provides instructions for a coding assessment project to create a candidate management system. It includes database design with a CANDIDATE_TBL table and CANDID_SEQ sequence. The system design specifies four packages - service for the console menu, bean for the CandidateBean entity, DAO for database operations, and util for database connection and exceptions. It describes the classes and methods needed within each package to meet the requirements.

Uploaded by

RITIK KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
280 views7 pages

Candidate Management System

The document provides instructions for a coding assessment project to create a candidate management system. It includes database design with a CANDIDATE_TBL table and CANDID_SEQ sequence. The system design specifies four packages - service for the console menu, bean for the CandidateBean entity, DAO for database operations, and util for database connection and exceptions. It describes the classes and methods needed within each package to meet the requirements.

Uploaded by

RITIK KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Project Assessment

GENERAL INSTRUCTIONS: Please carefully read the below instructions

The objective of this assessment is to check your ability to complete a project as per the
provided “Project Design”.

You are expected to –

1.      Write the source code for the classes, methods and packages EXACTLY as mentioned in
the “Project Design” section.

2.      Ensure that the names of the packages, classes, methods and variables EXACTLY
MATCH with the names specified in the “Project Design” section.

3.      Understand the project requirements and ACCORDINGLY WRITE the code and logic in
the classes and methods so as to meet all given requirements.

 
Candidate Management System
Project Objective:
Create a console based Java application that would allow the Admin of a training Institute to
add and view Candidate information details as per the design specifications given below.  The
data received from the user (Admin) will be stored in database and retrieved when required.

Project Design:
A. Database Design:
Create Table [ To be done using sql commands, after logging-in as the new user that has
been created in above step ]

Table Name : CANDIDATE_TBL

Colum Datatype Description


n
ID Varchar2(6) This field is the Primary Key.
Name Varchar2(15)  

Sensitivity: Internal & Restricted


M1 Number(3)  
M2 Number(3)  
M3 Number(3)  
Result Varchar2(15)  
Grade Varchar2(15)  
 

4.      Create Sequence:

Sequence Name : CANDID_SEQ

Sequence Minimum Max Incrementa Start


Name Value Values l value Value
CANDID_SEQ 5000 7000 1 5000
 

B. System Design:
Name of the package Usage
com.wipro.candidate.service This package will contain the class which displays the console menu and
take user input.
com.wipro.candidate.bean This package will contain the entity class named CandidateBean.
com.wipro.candidate.dao This package will contain the class that will do the database related
JDBC code.
com.wipro.candidate.util This package will contain the class to establish database connection and
also the class that handles the user defined exception.
 

Package: com.wipro.candidate.util

Class Method and Variables Description


DBUtil   DB connection class
  public static Connection getDBConn() Establish a connection to the
database and return the
java.sql.Connection reference
WrongDataException   User defined exception class.
Override the toString() method of
the Object class and return a
String “Data Incorrect”. This
exception will be thrown in the
CandidateMain class methods
whenever invalid input is given.
The details about when it has to be
thrown is given in the respective
methods of the CandidateMain

Sensitivity: Internal & Restricted


class
 

Package: com.wipro.candidate.bean

Class Method and Variables Description


CandidateBean   Bean class
  private String id Student Id
  private String name Student name
  private  int m1 Mark in First Subject
  private  int m2 Mark in Second Subject
  private  int m3 Mark in Third Subject
  private String result Result
  private String grade Grade
  setters & getters Should create the getter and setter
methods for all the attributes
mentioned in the class
 

Package: com.wipro.candidate.dao

Class Method and Variables Description


CandidateDA   DAO class
O
  public String addCandidate(CandidateBean          This method should take the
CandidateBean) values from the CandidateBean
object and insert it into the
database.
         If the insertion is successful,
then a String “SUCCESS” should
be returned, else a String “FAIL”
should be returned.
         If any JDBC exception such as
SQLException occur, this function
should return “FAIL”
  public          This method should use the
ArrayList<CandidateBean> getByResult(Strin JDBC select statement to retrieve
g criteria) the records based on the criteria
given.
         If the criteria String
contains “PASS” then
the getByResult(String
criteria) function should return
an ArrayList of all Candidates
who have passed
         If the criteria String

Sensitivity: Internal & Restricted


contains “FAIL” then
the getByResult(String
criteria) function should return
an  ArrayList of all Candidates
who have failed
         If the criteria String
contains “ALL” then
the getByResult(String
criteria) function should return
an ArrayList of all the Candidates
         In any of the criteria’s
“PASS/FAIL/ALL” if there are no
matching records then the
function should return null
         In case of any JDBCExceptions in
the database then a null value
needs to be returned
  public String generateCandidateId (String          This method should contain the
name) necessary code to create a new
Candidate id.
         CandidateID is a combination
of first 2 letters of
name in uppercasefollowed by 4
digit number that will be
generated by the oracle
sequence CANDID_SEQ.
         For eg, the Candidate id for a
Candidate Jacob could be JA2194
         The function should return the
generated Candidate id.
 
 

Package: com.wipro.candidate.service

Class Method and Variables Description


CandidateMai   Main class
n
  public static void main(String[] args) The code that is needed to test your
program goes here. A sample code is
shown at the end of the document.
  public          This method should add a
String addCandidate(CandidateBeancandBean) CandidateBean Object to the
database.
         The following are the conditions
under which a user defined
exception WrongDataException (fo

Sensitivity: Internal & Restricted


und
in com.wipro.candidate.util packag
e) should be thrown.
  candBean is null
  candBean’s name is empty
String
  candBean’s name contains less
than 2 characters
   candBean’s
mark1,mark2,mark3 contains
marks which are  not within 0
to 100 range.
         This exception should be handled
within
the addCandidate(CandidateBeancan
dBean) function itself.
         If this exception is caught, then the
function is expected to return a String
“Data incorrect”.
NOTE: Do NOT use System.exit(0) whi
le handling the exception.
         Compute Candidate ID
  If the candBean object is valid,
this function should call
the generateCandidateId
(String name) function of
the CandidateDAO  class to
obtain the candidate id. The
candBean’s name should be
passed as parameter to
the generateCandidateId
(String name) function
         The candBean’s id should be
initialized using the Candidate Id that
is received in the previous step
         Compute result and grade
  The result and grade are
computed using the following
logic
  M1=mark1 of candBean
  M2=mark2 of candBean
  M3=mark3 of candBean
Total Marks Result
(M1+M2+M3)>= 240 PASS
(M1+M2+M3)>=  180 and PASS
(M1+M2+M3)<240
(M1+M2+M3)>=  150 and PASS

Sensitivity: Internal & Restricted


(M1+M2+M3)<180
(M1+M2+M3)>= 105 and PASS
(M1+M2+M3) <150
(M1+M2+M3)  <105 FAIL
         Initialise the candBean’s result and
grade with the computed values
         Invoke addCandidate(CandidateBean
CandidateBean) of the CandidateDAO
class to insert the candBean into the
database.
         On successful storage of the
Candidate Details, to the table,  the
function should return the
CandidateID and result of the
particular CandidateBean 
         [ E.g if the Candidate ID generated is  
SA1001, and the result is PASS then
the success message should
be SA1001:PASS
         If by any reason, the record is not
stored, then the function should 
return the String Error
  public          This method should return the
ArrayList<CandidateBean>displayAll(String collection of the Candidates from the
criteria) Candidate table who are matching the
given criteria
         The criteria string can have values
such as “PASS/FAIL/ALL”.
         If the criteria contains either
“PASS/FAIL/ALL” then
invoke getByResult(String criteria) of
CandidateDAO class and receive the
collection
         If the criteria String contains any
other values then the
WrongDataException need to be
thrown, and the function should
return a null value.
         NOTE: Do NOT use System.exit(0) wh
ile handling the exception.
 
 
 

Test Cases:
Test 1: Test for Null Value for CandidateBean

Sensitivity: Internal & Restricted


Test 2: Test for Candidate Name to be Empty
Test 3: Test for Candidate Name less than 2 characters
Test 4: Test for Invalid range of Marks
Test 5: Test for correct CandidateId generation
Test 6: Test for checking correct computation of PASS, FAIL and grade
Test 7: Test for null value generation for different criteria (PASS/FAIL/ALL)
Test 8: Test the number of records retrieved for different criteria
Main Method:
You can write code in the main method and test all the above test cases. A sample
code of the main function to test the first test case is shown below for your reference.
public static void main(String[] args) {
CandidateMaincandidateMain = new CandidateMain();
String result = candidateMain.addCandidate(null);
System.out.println(result);
}

Sensitivity: Internal & Restricted

You might also like