Vous êtes sur la page 1sur 2

EX: NO.

1 DATE: AIM:

Rational number class in Java

Step 8: Stop the program. RESULT: Thus the program to implement Lisp-like list in Java was executed and the output was verified successfully. EX: NO. 4 DATE: AIM: To design a Java interface for ADT Stack and to develop two different classes that implements this interface, one using array and the other using linked-list. ALGORITHM: Step 1: Start the program. Step 2: Design an interface for Stack ADT with functions push, pop and display. Step 3: Define a class to implement the stack using array. Step 4: Define the functions of the interface accordingly and handle the stack overflow and underflow exceptions. Step 5: Define a class to implement the stack using linked list. Step 6: Define the functions of the interface accordingly and handle the exceptions. Step 7: Stop the program. RESULT: Design a Java interface for ADT Stack

To develop a Rational number class in Java, using JavaDoc comments for documentation. The implementation should use efficient representation for a rational number, i.e. (500 / 1000) should be represented as (). ALGORITHM: Step 1: Start the program. Step 2: Define a class with two integer data fields numerator and denominator. Step 3: Define a constructor to initialize the rational number and to simplify it. Step 4: Define methods to perform the basic arithmetic operations such as addition, subtraction, multiplication, division and reciprocal. Step 5: Call the appropriate functions with the corresponding arguments and display the result. Step 6: Stop the program. RESULT: Thus the program to develop a rational number class with methods to perform the basic arithmetic operations was executed and the output was verified successfully. EX: NO. 2 DATE: AIM: To develop Date class in Java similar to the one available in java.util package. Use JavaDoc comments. ALGORITHM: Step 1: Start the program. Step 2: Define an object today to the Date class and store the current date in that object. Step 3: Change the Date Format to Short, Long and Medium and display the date. Step 4: Convert the Date to String and print it. Step 5: Stop the program. RESULT: Thus the program to develop a Date class was executed and the output was verified successfully. EX: NO. 3 DATE: AIM: To implement Lisp-like list in Java. To perform the basic operations such as 'car', 'cdr', and 'cons'. ALGORITHM: Lisp-like list in Java Date class in Java

Thus the program to implement Stack ADT using array and linked list was executed and the output was verified successfully. EX: NO. 5 DATE: AIM: To design a Vehicle class hierarchy in Java and to demonstrate polymorphism. ALGORITHM: Step 1: Start the program. Step 2: Define a class Vehicle with fields register no. and model. Step 3: Define a method display which displays all the data fields. Step 4: Define the classes namely Twowheeler, Threewheeler and Fourwheeler as subclasses of Vehicle class. Step 5: These subclasses defines a method named display that overrides the super class method. Step 6: Create objects for the subclasses and call the appropriate methods. Step 7: Stop the program. RESULT: Thus the program to design vehicle class hierarchy and to demonstrate polymorphism was executed and the output was verified successfully EX: NO. 6 DATE: Random Generation of objects Design a Vehicle class hierarchy in Java

Step 1: Start the program. Step 2: Create a class LispCommands with a list in it. Step 3: Define a function parse to write the elements into the list. Step 4: Define a function car to return the leading element of the list. Step 5: Define a function cdr to return the list starting from the second element. Step 6: Define a function cons which adds an element to the front of the list. Step 7: Call the respective functions with the appropriate arguments.

AIM: . To design classes namely Currency, Rupee, and Dollar. To write a program that randomly generates Rupee and Dollar objects and writes them into a file using object serialization. To write another program to read that file, and to convert to Rupee if it reads a Dollar, while leave the value as it is if it reads a Rupee.

ALGORITHM: Step 1: Start the programs. Step 2: Define a class Currency as an abstract class with abstract methods. Step 3: Define the classes Rupee and Dollar as subclasses of Currency. Step 4: Define the abstract methods of the super class accordingly in each subclass. Step 5: The dollar value is converted to equivalent rupee value within a method of Dollar class. Step 6: Define a class StoreCurrency that randomly generates objects of Rupee and Dollar classes. Step 7: These objects are written into a file named currency using object serialization. Step 8: Define a class ReadCurrency that reads the objects from the file currency, and displays them. Step 9: Stop the programs. RESULT: Thus the program to generate objects randomly and to write them into a file using object serialization was executed. The file was read and the required rupee-dollar conversions were performed and the output was verified successfully. EXP: No. 7 DATE: Calculator in Java

RESULT: Thus the program to print the prime numbers in the Fibonacci series using multithreading was executed and the output was verified successfully. EXP: NO. 9 DATE: AIM: To develop a simple OPAC system for library using eventdriven and concurrent programming paradigms of Java. JDBC is used to connect to a back-end database. ALGORITHM: Step 1: Start the program. Step 2: Design the front end for the library system. Step 3: Connect the front end with the database at the backend using JDBC. Step 4: Design the front end such that it accepts the inputs from the user and inserts the records into the database. Step 5: Display the contents of the database at the front end. Step 6: Suspend the established connections. Step 7: Stop the program. RESULT: Simple OPAC system for library

AIM: To design a calculator using event-driven programming paradigm of Java. ALGORITHM: DATE: Step 1: Start the program. Step 2: Create a frame for the calculator and include the swing components such as buttons and text field as required in it. Step 3: Layouts such as Border Layout and Grid Layout are used to align the components as per the requirements of the calculator. Step 4: Redefine the actionPerformed() method in the ActionListener interface to perform the appropriate operations when the buttons are pressed. Step 5: Provide mechanisms to handle the Number Format exceptions that may occur. Step 6: Stop the program. RESULT: Thus the program to design a calculator was executed and the output was verified successfully. EXP: NO. 8 DATE: AIM: To write a program in Java that prints all the prime numbers in the Fibonacci series below 10000 using multithreading. ALGORITHM: Step 1: Start the program. Step 2: Create a thread called Prime Thread that stores all the prime numbers below 10000. Step 3: Create another thread called Fibonacci Thread that stores the elements of the Fibonacci series below 10000. Step 4: Prime Thread and Fibonacci Thread are assigned a higher priority than the main thread of the program. Step 5: The main thread reads the values stored by both the threads, checks for the common elements and prints them. Step 6: Stop the program. Multithreading in Java AIM: To develop a multithreaded echo server and a corresponding client. ALGORITHM: Step 1: Start the program. Step 2: Create a Socket at the Server side. Step 3: Design the server such that it responds to each client using a separate thread. Step 4: The server receives the data sent by the client and echoes those data. Step 5: Provide the necessary exception handling mechanisms at the server. Step 6: Create a Socket at the client side. Step 7: Get the host name from the user. Step 8: Establish a connection between the server and the client. Step 9: Transmit the data from the client side to the server. Step 10: Provide the necessary exception handling mechanisms at the client. Step 11: Stop the program. RESULT: Thus the program to develop a multithreaded echo server and client was executed and the output was verified successfully. Thus the program to design a simple OPAC system for library was executed and the output was verified successfully. EXP: NO. 10 Multithreaded Echo Server and Client

Vous aimerez peut-être aussi