0% found this document useful (0 votes)
15 views31 pages

Ex No1

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)
15 views31 pages

Ex No1

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/ 31

VEL TECH HIGH TECH

Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE


(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 1

Develop a Java application to generate Electricity bill. Create a class with the following
members: Consumer no., consumer name, previous month reading, current month reading
,type of EB connection (i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic ,calculate the amount to be paid as follows:
 First100 units -Rs. 1perunit
 101-200units -Rs.2.50 per unit
 201-500 units -Rs.4 per unit
 Greaterthan501 units- Rs. 6perunit
If the type of the EB connection is commercial, calculate the amount to be paid as
follows:
 First100 units -Rs. 2perunit
 101-200units -Rs.4.50 per unit
 201-500 units -Rs.6 per unit
 Greaterthan501 units- Rs. 7perunit.

Aim
To implement class and object creation by developing a java programme for generating Electricity bill.
Generate Electricity bill by creating a class with the following members: Consumer no., consumer
Name, previous month reading, current month reading, type of EB connection (i.e. domestic or
commercial) and compute the bill amount using the following tariff.

If the type of the EB connection is domestic, calculate the amount to be paid as follows:
First 100 units - Rs. 1 per unit
101-200 units - Rs. 2.50 per unit
201 -500 units - Rs. 4 per unit
> 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
First 100 units - Rs. 2 per unit
101-200 units - Rs. 4.50 per unit
201 -500 units - Rs. 6 per unit
> 501 units - Rs. 7 per unit

Algorithm
1. Start the program
2. Create a class with the name Electricity Bill.
3. Get the details of the user and type of the connection.
4. Calculate the tariff based on the type of connection.
5. Compile and Execute the class “Electricity Bill”, and generate the appropriate output.
Presented in Board of Studies meeting held on --.04.2021(Approved)
Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

6. Stop the program

Flow chart for Ex. No– 1

PSEUDOCODE
Read a units
Read a usage type
IF usage_type equal “Residential”
IF units >0and units <=200 THEN
Bill= units*0.8
ELSE IF units >200 and units <=999 THEN
Bill= units*0.7
ELSE
Bill= units*0.5
END IF
END IF
ELSE
IF units >0and units <=200 THEN
Bill= units*0.6
Presented in Board of Studies meeting held on --.04.2021(Approved)
Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

ELSE IF units >200 and units <=999 THEN


Bill= units*0.3
ELSE
Bill= units*0.2
END IF
END IF
END IF

Concept videos for Ex. No - 1

S. No Topic Link Author


Class & Object | Methods https://www.youtube.com/watc
VL - 1 SDET- QA Automation Techie
h?v=JXVZYUfAipw
https://www.youtube.com/watc
VL - 2 Conditional Statements in java Tech Raj
h?v=0M6ZFTzw0Gs&t=321s
https://www.youtube.com/watc
h?v=MAd2CpFzsMI&list=PL
VL - 3 To generate Electricity bill Join To Learn
CebYeZFwqPp5pgGtPvkP9S6
VWPNibgEX&index=2

Animated videos for Ex. No - 1

S. No Topic Link Author


Conditional Statements in https://www.youtube.com/watch?v=
VL - 1 Transcode
java HQ3dCWjfRZ4
https://www.youtube.com/watch?v=
VL - 2 Class & Object | Methods Kodable
X3cFiJnxUBY
https://www.youtube.com/watch?v=
VL - 3 To generate Electricity bill dV5LpYwK9uM ByteCodeSkool

Exercise problem for Ex. No - 1

1. Write a java program to find the reverse of a given number.


2. Write a java program to find odd and even number
3. Write a program for swapping of two numbers.
4. Write a java program to find the Fibonacci series using recursive functions.
5. Write a program for sum of first n numbers.
6. Write a program to display all prime numbers from 1 to N.
7. To write a java program to find the age greater than 18 and less than 25.
8. To write a java program to find odd and even number.
9. To write a program for swapping of two numbers.
10. Java program to find Greatest of three Numbers

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

RESULT
Java program to generate electricity bill has been developed and was tested with sample
values.

VIVA-VOCE QUESTIONS

1. What are the pillars of OOPs?


2. Difference between header files and import packages.
3. What are Encapsulation, Inheritance and Polymorphism?
4. What is the purpose of java virtual machine (JVM)?
5. Difference between C++ and Java.
6. What are the purpose of class and object?
7. What do you mean by Platform Independence?
8. What is JIT Compiler?
9. What all memory areas are allocated by JVM?
10. What are java buzzwords? List popular java IDEs?
11. What is a class and Object?
12. What is instance?
13.Why do we need the import statement in Java?
14. What is the use of Scanner class?
15. What is a loop statement?
16. What is validation?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 2

Develop a java application to implement currency converter (Dollar to INR, EURO to INR,Yen to
INR and vice versa), distance converter (meter to KM, miles to KM and vice versa) ,time
converter(hours to minutes, seconds and vice versa) using packages.

Aim

To implement packages by writing a java programme for currency converter (Dollar to INR, EURO to
INR, Yen to INR and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time
converter (hours to minutes, seconds and vice versa) .

Algorithm
1. Start the program
2. Create a class with the name Conversion
3. Create a Package with the name mypack1 and import the mypack1 in the conversion program
4. Create a class currency converter, distance converter, time converter in the package calledmypack1.
5. Call the currency converter, distance converter, time converter from the conversion class.
6. Get the details of the user for the corresponding conversion and print it.
7.Stop the Program

Flow chart for Ex. No– 2

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Concept videos for Ex. No - 2

S. No Topic Link Author


https://www.youtube.com/watc
VL - 1 Constructor h?v=maIQSChEgoA&t=3s Sundeep SaradhiKanthety

https://www.youtube.com/watc
VL - 2 switch Statement in Java h?v=wcwWlasmLWs
Neso Academy
https://www.youtube.com/watc
VL - 3 The Do While Loop in Java h?v=2E-UgePiOoo
Neso Academy
Currency Converter |
https://www.youtube.com/watc
Distance Converter | Time
VL - 4 h?v=crDuk6Y_Jig&t=60 RK Keynotes
Converter s

Animated videos for Ex. No -2

S. No Topic Link Author


https://www.youtube.com/watch?v=
VL - 1 Constructor O4G1pl96Zaw Learn Programming Yourself

https://www.youtube.com/watch?v=
pPHBEYblDMw&list=PLZTETldy
VL - 2 switch Statement in Java guF0ZqpdwU3jM_UgHu7- Learn Programming Yourself
fI9hM&index=14

https://www.youtube.com/watch?v=
jYAnbGfWN6g&list=PLZTETldyg
VL - 3 The Do While Loop in Java uF0ZqpdwU3jM_UgHu7- Learn Programming Yourself
fI9hM&index=23

Exercise problem for Ex. No - 2


1. Write a Java Program to implement Packages.
2. Write a Java Program to implement Access Protection in Packages.
3. Write a java program to create user defined package
4. Write a java program to access the name using constructor.
5. Java program to input the month number and print the month's using switch case.
6. write a program to print numbers from 1 to 10 using do while loop in java
7. Java Program to Print Sum of Odd Numbers between 1 to 100
RESULT
Java program to convert one form of currency, distance and time into other form has been
developed and tested with sample values.

VIVA-VOCEQUESTIONS
I. What is package?
2. Package types? Example?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

3. Use of nested switch.


4.While and do-while difference.
5. Use of = and ==?
6. What is .charAt() refers to? nextDouble() vs nextInt().
7. What is constructor?
8. Where constructor is used in the program?
9.Point 3 places where object created.
10. Point 3 different location where reference variable called.

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 3

DevelopajavaapplicationwithEmployeeclasswithEmp_name,Emp_id,Address,Mail_id,Mobile no
as members.Inherit the classes, Programmer, Assistant Professor, AssociateProfessor and Professor
from employee class. Add Basic Pay (BP) as the member of all theinherited classes with 97% of
BP as DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BPforstaffclubfund. Generate payslips
forthe employees with theirgross and netsalary.

Aim

To implement Inheritance by developing a java programme with Employee class with Emp_name,
Emp_id, Address, Mail_id, Mobile_no as members. Inherit the classes, Programmer, Assistant
Professor, Associate Professor and Professor from employee class. Add Basic Pay (BP) as the member
of all the inherited classes with 97% of BP as DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
.
Algorithm
1. Start the program.
2. Create a class called Employee with Emp_name, Emp_id, Address, Mail_id, Mobile_no as members
and
compute the payslip
3. Extends the Employee class for further classes called Programmer, Assistant Professor, Associate
Professor and Professor
4. Create class called Pay slip and generate Pay slip according to the position of the Employee.
5. Stop the program.

Flow chart for Ex. No– 3

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Concept videos for Ex. No - 3

S. No Topic Link Author


https://www.youtube.com/watc
VL - 1 Default constructor h?v=maIQSChEgoA&t=3s Sundeep SaradhiKanthety

https://www.youtube.com/watc
VL - 2 Parameterized constructor h?v=maIQSChEgoA&t=3s Sundeep SaradhiKanthety

https://www.youtube.com/watc
VL - 3 this() and super keyword h?v=iIvp8Ffa3e4 Sundeep SaradhiKanthety

https://www.youtube.com/watc
Generate Payslip by Inheriting the
VL - 4 h?v=jXRrDcX79Hw&t=2s RK Keynotes
Members from One Class

Animated videos for Ex. No - 3

S. No Topic Link Author


https://www.youtube.com/watch?v=
VL - 1 Default constructor wjsTWsWpTfY CodeVerse

https://www.youtube.com/watch?v=
VL - 2 Parameterized constructor wjsTWsWpTfY CodeVerse

https://www.youtube.com/watch?v=
VL - 3 this() and super keyword 7d1X0lTWz2U CodeVerse

Generate Payslip by https://www.youtube.com/watch?v=


VL - 4 Inheriting the Members from jXRrDcX79Hw&t=2s RK Keynotes
One Class

Exercise problem for Ex. No - 3

1.Write a java program for salary calculation of employee


2.Write a java program for this() and super keyword
3.To write a java program to access the name and roll no of a student using Default constructor
4.To write a java program to access the name and roll no of a student using Parameterized constructor

RESULT

Java program to demonstrate inheritance to the employee class with various type of employee has been
developed to generate the salary slip ofthe employees.

VIVA-VOCEQUESTIONS

1.What is default constructor?


2.Difference between this and super keyword.
3.Difference between extend and implements.
4. List Super keyword rules.

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

5. Point 2 places where parameters and arguments used.


6. In the above program, where a method is called?
7. What is inheritance
8. What type of inheritance is used in the above program?
9.Class files consists of?
10.What is a Java JAR file?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 4

Design a Java interface for ADT Stack. Implement this interface using array. Provide necessary
exception handling in both the implementations.

Aim
To implement a Java interface for ADT Stack by implementing this interface using array and to
provide necessary exception handling in both the implementations.

Algorithm

1: Start the program


2: Create an interface which consists of three methods namely PUSH, POP and DISPLAY
3: Create a class which implements the above interface to implement the concept of stack through Array
4: Define all the methods of the interface to push any element, to pop the element and to display the
elementspresent in the stack.
5: Create another class which implements the same interface to implement the concept of stack through
linkedlist.
6: Repeat STEP 4 for the above said class also.
7: In the main class, get the choice from the user to choose whether array implementation or linked list
implementation of the stack.
8: Call the methods appropriately according to the choices made by the user in the previous step.
9: Repeat step 6 and step 7 until the user stops his/her execution
10: Stop the program.

Flow chart for Ex.NO:4

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Concept videos for Ex. No - 4

S. No Topic Link Author


https://www.youtube.com/watch?v=
1 Interfaces Sundeep SaradhiKanthety
Mj8uanC2Wn0
https://www.youtube.com/watch?v=
2 Stack Sundeep SaradhiKanthety
i7SgAJHcx00
https://www.youtube.com/watch?v=
3 ADT Sundeep SaradhiKanthety
p_4Dyfplqkw
https://www.youtube.com/watch?v=
4 Exception Handling Sundeep SaradhiKanthety
9kI0_F41i5Y
https://www.youtube.com/watch?v=
5 Stack ADT Using Interface ocGSMDdyWjc RK Keynotes

Animated videos for Ex. No - 4

S. No Topic Link Author


https://youtu.be/lbVmrWqY-VA
1 Interfaces Codearchery
https://youtu.be/1SWr7q121gc
2 Stack Codearchery
https://youtu.be/EmjMkxdjRvU
3 ADT Codearchery
https://youtu.be/8O3Rps_bzhE
4 Exception Handling
SNIPPET_MASTERY

Exercise problem for Ex. No - 4

1.Write a java program to find the area of rectangle using Interfaces.


2.Write a java program to Implement stack using Stack class

3.Write a java Program to design an interface for Stack ADT. and implement Stack ADT using both
Array and Linked List.
4.Write a Java program for Exception Handling in try-catch statement to handle the exception.

RESULT

Java program to implement an interface for the stack operation has beendeveloped and
tested with sample values to throw an exception.

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

VIVA-VOCEQUESTIONS

1. What is default constructor?


2. Difference between this and super keyword.
3. Difference between extend and implements.
4. List Super keyword rules.
5. Point 2 places where parameters and arguments used.
6. In the above program, where a method is called?
7. What is inheritance
8. What type of inheritance is used in the above program?
9. Class files consists of?
10. What is a Java JAR file?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2


Experiment No: 5

Write a program to perform string operations using Array List. Write functions for the following
a. Append- add at end
b.Insert –add at particular index
c.Search
d.List all string starts with given letter
Aim

To write a program to perform string operations using Array List.

Algorithm

1. Start the program


2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
a. Append-add at end
b. Insert-add at particular index
c. Search
d. List all string starts with given letter.
3. Display the result
4. Stop the program.

Flow chart for Ex.No:5

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Concept videos for Ex. No - 5

S. No Topic Link Author


https://www.youtube.com/watch?v=
1 Array List Neso Academy
YgkRoY3-ng8
Java Iterator Interface https://www.youtube.com/watch?v=
2 Programming For Beginners
89svYoJeOvo
https://www.youtube.com/watch?v
3 Scanner class Vignesh Waran
=I17sQfT5MZo
String operation using Array https://www.youtube.com/watch?v=
4 List & Perform Append, dVzZx-aHTX4 RK Keynotes
Insert, Search, Display

Animated videos for Ex. No - 5

S. No Topic Link Author


https://www.youtube.com/watch?v=
1 Array List DNu92A3kwaY Nathan S

https://www.youtube.com/watch?v=
Java Iterator Interface
2 53cFp9P9ao8 Nathan S

https://www.youtube.com/watch?v
3 Scanner class Vignesh Waran
=I17sQfT5MZo

Exercise problem for Ex. No - 5


1. Write a Java program to read data of various types using Scanner class.
2. Write a java program to find odd or even number using array.
3. Write a java program to sort elements of an array in ascending and descending order.
4. Write a program to find largest element in an array
5. Write a java program to add and subtraction of two matrices using array
6. Write a java program to find the sum of each row and each column of a matrix using array

RESULT

Java program to demonstrate string operation using ArrayList has beendeveloped and tested
with sample values.

VIVA-VOCEQUESTIONS
1. What is ArrayList? Advantages?
2. What is append?
Presented in Board of Studies meeting held on --.04.2021(Approved)
Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

3. Str = scanner.next() vs str = scanner.nextInt()


4. What is iterator? D/B ArrayList and Iterator.
5. Tell about, add() | equals() | startsWith() | hasNext()
6. arraycopy() charAt()|
7. What is the role of switch case?
8. Difference between \n and \t vs println vs println and print and printf
9. Tell about exception handling.
10. Drawbacks of ArrayList and Iterator? Solution?
11. Drawbacks of iterator

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 6

Write a Java Program to create an abstract class named Shape that contains two integers and an empty
method named print Area(). Provide three classes named Rectangle, Triangle and Circle such that
each one of the classes extends the class Shape. Each one of the classes contains only the method
print Area () that prints the area of the given shape.

Aim

To write a Java Program to create an abstract class named Shape and provide three classes
named Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape.

Algorithm

1. Start the program


2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle, Triangle and Circle .
7. Stop the Program
Flow chart for Ex.No:6

Animated videos for Ex. No - 6


Presented in Board of Studies meeting held on --.04.2021(Approved)
Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

S. No Topic Link Author


Java Program to Implement https://www.youtube.com/watch?v=
1 Abstract Class Concept LOOdWSEBHx8 RK Keynotes
Using NetBeans IDE
2. Abstract classes https://www.youtube.com/ CODEARCHERY
and Methods watch?v=GtsoUtGXu4Q

Concept videos for Ex. No - 6

S. No Topic Link Author


Java Program to Implement https://www.youtube.com/watch?v=
1 Abstract Class Concept LOOdWSEBHx8 RK Keynotes
Using NetBeans IDE
Abstract classes https://www.youtube.com/ TUTORIALSPOINT
2.
and Methods watch?v=vkYJFrTrh5M

Exercise problem for Ex. No - 6

1. Write a Java program to create an abstract class Bird with abstract methods fly() and make Sound().
Create subclasses Eagle and Hawk that extend the Bird class and implement the respective methods
to describe how each bird flies and makes a sound.
2. Write a Java program to create an abstract class Instrument with abstract methods play() and tune().
Create subclasses for Glockenspiel and Violin that extend the Instrument class and implement the
respective methods to play and tune each instrument.

3. Write a Java program to create an abstract class Employee with abstract methods calculate Salary()
and display Info(). Create subclasses Manager and Programmer that extend the Employee class and
implement the respective methods to calculate salary and display information for each role.

RESULT

Java program to create an abstract class Shape with derived classes Rectangle, Triangle and Circle has
been developed to find the area of different shapes and tested with sample values.

VIVA-VOCEQUESTIONS

1. What is Abstract class in Java? How to define it?

2. What is the difference between abstract class and concrete class?

3. Can an abstract method be declared with private modifier?

4. Why abstract class has constructor even though you cannot create object?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 7

Write a Java program to implement user defined exception handling.

Aim

To write a Java program to implement user defined exception handling

Algorithm

1. Start the program


2. Define the exception for getting a number from the user.
3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ‘Number must be positive’.
5. Stop the Program.

Flow chart for Ex.No:7

Animated videos for Ex. No - 7

S. No Topic Link Author


https://www.youtube.com/watch?v=
1. User Defined Exception 4sZbU3PRYTA RK Keynotes

https://www.youtube.com/w
2. Creating own exceptions atch?v=y01wPwVQqvU SNIPPET_MASTERY

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Concept videos for Ex. No - 7

S. No Topic Link Author


https://www.youtube.com/watch?v=
1. User Defined Exception 4sZbU3PRYTA RK Keynotes

Creating own exceptions https://www.youtube.com/ SUDHAKAR ATCHALA


2. watch?v=P8eLudVQ1Tc

Exercise problem for Ex. No - 7

1.Write a Java program that throws an exception and catch it using a try-catch block.

2.Write a Java program to create a method that takes a string as input and throws an exception if the
string does not contain vowels.

RESULT

Java program to implement the user defined exception to check the input value within the given range
has been developed and tested with sample values.

VIVA-VOCEQUESTIONS

1. What is the difference between final, finally, and finalize in Java?

2. Explain an unreachable catch block error.

3. What are the types of exceptions?

4. What is the hierarchy of exceptions in Java?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 8

Write a Java program that reads a filename from the user, displays information about whether the file
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.

Aim

To write a Java program that reads a file name from the user, displays information about whether
the file exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.

Algorithm

1. Start the program


2. Read the filename from the user
3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent’s information.
6. Use exists() Method to display whether the file exist or not
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
11. Use isHiddden() Method to display whether the file is hidden or not.

Flow chart for Ex.NO:8

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Animated videos for Ex. No - 8

S. No Topic Link Author


https://www.youtube.com/watch?v=
1 Display File Properties 03nhYdN9ShM RK Keynotes

FILE https://www.youtube.com/watch? edureka!


INFORMATION
2 v=SslMi6ptwH8

Concept videos for Ex. No - 8

S. No Topic Link Author


1. FILE INFORMATION https://www.youtube.com/watch?v=S Coding with John
cUJx4aWRi0

Exercise problem for Ex. No - 8

1. Write a Java program to read a file line by line and store it in a variable.
2. Write a Java program to append text to an existing file.
3. Write a Java program to find the longest word in a text file.
4. Write a Java program to read the contents of a file into a byte array.

RESULT

Java program to know the file information has been developed and tested with sample values.

VIVA-VOCEQUESTIONS
1. What are the different ways of reading a file in Java?
2. How do you read from and write to files using Java code?
3. When should we use serialization? Where is it useful?
4. What is the difference between deep cloning and shallow cloning?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 9

Write a java program that implements a multi-threaded application that has three threads. First thread
generates a random integer every 1 second and if the value is even, second thread computes the square
of the number and prints. If the value is odd, the third thread will print the value of cube of the number.
Aim

To write a java program that implements a multi-threaded application

Algorithm
1. Start the program
2. Design the first thread that generates a random integer for every 1 second .
3. If the first thread value is even, design the second thread as the square of the number and
then print it.
4.If the first thread value is odd, then third thread will print the value of cube of the number.
5. Stop the program

Flow chart for Ex.NO:4

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Animated videos for Ex. No - 9

S. No Topic Link Author


https://www.youtube.com/watch?v=
1 Multi-threaded Application Cyw6oChxIng&t=22s RK Keynotes

1. https://www.youtube.com/
Creating MultiThreads watch?v=bWRdvMkaZQ4
Engineer's choice tutor

Concept videos for Ex. No - 9

S. No Topic Link Author


https://www.youtube.com/watch?v=
1 Multi-threaded Application Cyw6oChxIng&t=22s RK Keynotes

Creating https://www.youtube.com/ Sundeep Saradhi Kanthety


1. MultiThreads watch?v=82pwIB8Rv2w

Exercise problem for Ex. No - 9

1. Write a Java program to create a basic Java thread that prints "Hello, World!" when executed.
2. Write a Java program that creates two threads to find and print even and odd numbers from 1 to
20.
3. Write a Java program that creates a bank account with concurrent deposits and withdrawals using
threads.
4. Write a Java program that calculates the sum of all prime numbers up to a given limit using multiple
threads.

RESULT
Java program to implement the multi-threaded application with three threads by generating a
random number and to find the square and cube ofthe number and which is tested with random
numbers.
VIVA-VOCEQUESTIONS
1. What is the thread?
2. Differentiate between process and thread?
3. What is the purpose of wait() method in Java?
4. What are the states in the lifecycle of a Thread?

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Experiment No: 10

Write a java program to find the maximum value from the given type of elements using a generic
function.

Aim

To write a java program to find the maximum value from the given type of elements using
a generic function

Algorithm
1. Start the program
2. Define the array with the elements
3. Sets the first value in the array as the current maximum
4. Find the maximum value by comparing each elements of the array
5. Display the maximum value
6. Stop the program

Flow chart for Ex.NO:4

Animated videos for Ex. No - 4

S. No Topic Link Author


https://www.youtube.com/watch?v=
1 Generic Programming FJ2vWfTsZpI RK Keynotes

1. Generic https://www.youtube.com/
Programming watch?v=o9YzJN0-AT4
GenericClasses JAVA9S
GenericMethods

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Concept videos for Ex. No - 10

S. No Topic Link Author


GenericProgram https://www.youtube.com/
1. ming– watch?v=22AUtQnTZkY TUTORIALS POINT
GenericClasses

GenericMethods

Exercise problem for Ex. No - 10

1. Write a generic method to exchange the positions of two different elements in an array.
2. Write a generic method to count the number of elements in a collection that have a specific property (for
example, odd integers, prime numbers, palindromes).

RESULT

Java program to implement the generic method to find the maximum among two values has
been developed and tested with different data typevalues

VIVA-VOCEQUESTIONS
1. What is Java Generics?
2. What is the purpose of generics in Java?
3. What is type parameterization in Java?
4. How do you create a generic class in Java?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 11

Design a calculator using event-driven programming paradigm of Java with the following options.
Decimal manipulations Scientific manipulations.

Aim

To design a calculator using event-driven programming paradigm of Java for Decimal manipulations
and Scientific manipulations.

Algorithm

1. Start the program


2. Using the swing components design the buttons of the calculator
3. Use key events and key listener to listen the events of the calculator.
4. Do the necessary manipulations.
5. Stop the program.

Flow chart for Ex.NO:4

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Animated videos for Ex. No - 11

S. No Topic Link Author


Scientific Calculator using https://www.youtube.com/watch?v=
1 RK Keynotes
Swing jXlIrU96Wwc
Event Driven https://study.com/academy/  Alida D.
Programming lesson/event-driven-
programming-in-java-
2
definition-
components.html

Concept videos for Ex. No - 11

S. No Topic Link Author


Event Driven https://www.youtube.com/wat
1 Programming ch?v=P0jXtNX6fiI Jamaa

Exercise problem for Ex. No - 11

1. Write a Java Program to implement event handling by implementing ActionListener.


2. Write a Java Program to implement event handling by outer class.
3. Write a Java Program to implement event handling anonymous class

RESULT
Java program for decimal calculator and scientific calculator has been developed and
tested with sample values

VIVA-VOCEQUESTIONS
1. What interface is extended by AWT event listener?
2. What is an event and what are the models available for event handling?
3. What are the advantages of the model over the event inheritance model?
4. What is an adapter class?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Course code 21AI37P Semester III


Category ENGINEERING SCIENCE COURSE (ESC) L T P C

Course Title JAVA PROGRAMMING LABORATORY 0 0 4 2

Experiment No: 12

Write a java program that perform virtual piano to play music using Jdesign

Aim

Write a java program to develop virtual piano.

Algorithm
1. Create a package for virtual piano application
2. Create a class that extends J frame to implement key lisenter and create an object to read the
event actions
3. Create an Jframe to draw piano and create a jbutton and provide required action
4. Create a method to get key pressed action and input stream to receive data from the Keyboard
5. Create an exception to get audio stream according to the key pressed and continue step 7, 8, 9 to
get different audio stream in different input stream
6. Create another method to get key released action

Flow chart for Ex.NO:12

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

Animated videos for Ex. No - 12

S. No Topic Link Author


1. Virtual piano https://www.youtube.com/ DJ Oamen
watch?v=l8dfU7SnjcM

Concept videos for Ex. No - 12

S. No Topic Link Author


1. Virtual piano https://www.youtube.com/ DJ Oamen
watch?v=l8dfU7SnjcM

Exercise problem for Ex. No - 12

1. To develop a mini project OPAC system for library using Java concepts.
2. To develop a mini project Bank Mangement system using Java concepts.

RESULT

Java program for vritual piano delevoped and tested.

VIVA-VOCEQUESTIONS
1. How do you define and use variables in Java?
2. What are the different ways to create objects in Java?
3. What’s the difference between an array and an ArrayList?
4. What’s the benefit of using interfaces over abstract classes?

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021
VEL TECH HIGH TECH
Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE
(An Autonomous Institution, Affiliated to Anna University, Chennai)
R-2021 UG Syllabus for 21BT32T

LEARNINGRESOURCES:

TEXTBOOKS:

1. Herbert Schildt, ―Java The complete reference‖, 8th Edition, McGraw Hill
Education,2017.
2. Cay S. Horstmann, Gary cornell, ―Core Java Volume –I Fundamentals‖, 9th Edition,
Prentice Hall, 2017.
3. E.Balagurusamy, Programming with Java, Tata McGill. , Fifth Edition, 20

REFERENCES:
1. Paul Deitel, Harvey Deitel, ―Java SE 8 for programmers‖, 7th Edition, Pearson, 2019.
2. Steven Holzner, ―Java 2 Black book‖, Dreamtech press, 2014.
3. Timothy Budd, ―Understanding Object-oriented programming with Java‖, Updated
Edition, Pearson Education, 2000.

COURSE CONTENTS DEVELOPED BY

S.No Name Specialisation Mail ID

1 R.Veerasundari.R AI&DS [email protected]

2 L.Geetha AI&DS [email protected]

Presented in Board of Studies meeting held on --.04.2021(Approved)


Passed in the 1st Academic Council meeting dated --.04.2021
Form No.CD 02 C Rev.No.00 Effective Date: 1/06/2021

You might also like