COURSE OBJECTIVE:
To build software development skills using java programming for real-world applications.
To understand and apply the concepts of classes, packages, interfaces, array list
To understand and apply the concepts of inheritance and polymorphism
To understand exception handling and file processing.
To develop applications using generic programming and event handling.
23IT1311 - OBJECT ORIENTED PROGRAMMING LABORATORY
LIST OF EXPERIMENTS
1. Write a java program that prints all real solutions to the quadratic equation ax2 +bx+c=0. Read in a, b, c and use the quadratic formula.
2. The Fibonacci sequence is defined by the following rule. The first two values in the sequence are 1 and 1. Every subsequent value is the sum of the two values preceding it. Write a java program that uses both recursive and non recursive functions.
3. Write a java program for sorting a given list of names in ascending order
4. Write a program that prompts the user for an integer and then prints out all prime numbers up to that integer.
5. Write a Java program to Multiply two given matrices
6. Write a Java program that checks whether a given string is a palindrome or not
7. 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).
8. 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.
9. Develop a java application 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.
10. Design a Java interface for ADT Stack. Implement this interface using array. Provide necessary exception handling in both the implementations.
11. Write a program to perform string operations using ArrayList. 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
12. 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.
13. Write a Java program to implement exception handling.
14. 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.
15. 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.
16. Write a java program that implements producer consumer problem using the concept of inter thread communication
17. Write a java program to find the maximum value from the given type of elements using a generic function.
18. Write a java program that simulates a traffic light. The program lets the user select one of three lights: Red, Yellow or Green with radio buttons. On selecting a button an appropriate message with “STOP “or “READY” or “GO” should appear above the buttons in selected color. Initially, there is no message shown.
19. Design a calculator using event-driven programming paradigm of Java using Scientific manipulations
20. Write a program to implement HashSet Class.
21. Develop a mini project for any application using Java concepts.
TOTAL: 60 PERIODS
OUTCOMES: Upon successful completion of the course, students will be able to:
CO1: Understand to write basic programs in JAVA
CO2: Design simple JAVA programs by applying classes and objects
CO3: Implement the concepts of Inheritance, interfaces and packages.
CO4: Design real time problems with multithreading and exceptional handling concepts.
CO5: Evaluate complex programs with the help of collection framework and I/O
CO6: Build applications by incorporating AWT and swing components
REFERENCE: spoken-tutorial.org
LIST OF EQUIPMENT FOR A BATCH OF 30 STUDENTS
HARDWARE:
Standalone desktops 30 Nos. (or) Server supporting 30 terminals or more
SOFTWARE:
Front end: JAVA or Equivalent,Java Standard Edition (Java SE) 9
Back end: Oracle / SQL / MySQL/ or Equivalent
Suggested Software Tools: NetBeans IDE, Eclipse IDE
ADDITIONAL PROGRAMS
1. Design a class to represent a Student details include the Student ID, Name of the Student, Branch, year, location and college. Assign initial values using constructor. Calculate average of marks of 6 subjects and calculate attendance percentage.
2. Develop with suitable hierarchy, classes for Point, Shape, Rectangle, Square, Circle, Ellipse, Triangle, Polygon, etc. Design a simple test application to demonstrate dynamic polymorphism
3. Write a program that creates three threads. First thread displays “Good Morning” every one second, the second thread displays “Hello” every two seconds and the third thread displays “Welcome” every three seconds.
4. Write a java programs to find factorial of a number. User is allowed to enter a number into the text field whose factorial is to be determined. On pressing the button the value of the text field is firstly converted into integer and then processed to find its factorial. The result will get displayed in another text field.(Hint: use swings).