0% found this document useful (0 votes)
103 views2 pages

Assignment-2 PBLJ Theory

The document provides instructions for an assignment involving Java programming and JUnit testing. It includes 3 questions divided into 3 sets. Set 1 involves creating an ArrayList of Employee objects and searching by ID, as well as writing JUnit tests for a method to search a list of employees by name. Set 2 focuses on storing employee names in a HashSet and querying data from an Oracle database table. Set 3 covers creating a TreeSet of Strings with specific capabilities, writing a program to copy one file to another, and creating a class to check if a string is a palindrome along with JUnit tests.

Uploaded by

madhu jha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views2 pages

Assignment-2 PBLJ Theory

The document provides instructions for an assignment involving Java programming and JUnit testing. It includes 3 questions divided into 3 sets. Set 1 involves creating an ArrayList of Employee objects and searching by ID, as well as writing JUnit tests for a method to search a list of employees by name. Set 2 focuses on storing employee names in a HashSet and querying data from an Oracle database table. Set 3 covers creating a TreeSet of Strings with specific capabilities, writing a program to copy one file to another, and creating a class to check if a string is a palindrome along with JUnit tests.

Uploaded by

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

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Subject: Project Based Learning in Java

Subject Code: 20CST-319/ 20ITT-319

Semester: 5th Batch: 2020

Assignment -2

Last date of Submission: 17 Oct., 2022 Total Marks: 10 (2 Questions of 2.5


marks , 1 Question of 5 marks)
*Note: Every student needs to submit assignment as per the allotted set mentioned
in attached PDF.

Set – 1
1. Create an ArrayList of Employee( id,name,address,sal) objects and search for particular 2.5 marks
Employee object based on id number.
2. Create a class Employee and implement the below method in the class. 2.5 marks
Write Junit testcases to test the below given method:

public String findName(ArrayList employees,String name){


String result="";
if(employees.contains(name)){
result="FOUND";
}else{
result="NOT FOUND";
}
return result;
}

3. File : Count Character 5 marks


Write a program to count the number of times a character appears in the File. (Case
insensitive... 'a' and 'A' are considered to be the same)

Sample Output:
Enter the file name
Input.txt
Enter the character to be counted
r
File 'Input.txt' has 99 instances of letter 'r'.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Set – 2
1. Write a program to store a group of employee names into a HashSet, retrieve the elements 2.5 marks
one by one using an Iterator.
2. Write a java program that connects to oracle database, queries the inbuilt table “emp” and 2.5 marks
displays the first two columns (empno using column index and ename using column name
) of all the rows.

3. ABC International School wants to computerize students details. The school maintains a 5 marks
database of students in Oracle. The student table contains information related to students
and is shown in the following student table structure.
Column Name Type Constraint
Rollno Number (4) Primary Key
StudentName Varchar (20) Not Null
Standard Varchar (2) Not Null
Date_Of_Birth Date
Fees Number (9,2)

Set – 3
1. Create Collection called TreeSet which is capable of storing String objects. The Collection 2.5 marks
should have the following capabilities
a)Reverse the elements of the Collection
b)Iterate the elements of the TreeSet
c) Checked if a particular element exists or not

2. File Copy 2.5 marks


Write a program to copy from one file to another.

Sample Input and Output:


Enter the input file name
Input.txt
Enter the output file name
Output.txt

3. i) Create the following class and implement the method to check whether given string is a 5 marks
palindrome and return the result,
Class Name : MyUnit
Method : palindromeCheck(String):boolean

(Hint: If the reversed string is equal to the actual string is palindrome string. Ex: madam,
mom, dad, malayalam )
ii) Create a Junit test class to test the above class.

You might also like