Académique Documents
Professionnel Documents
Culture Documents
DATE: RESULT:
ALGORITHM: AIM:
Step 1: Start the program. To design a Java interface for ADT Stack and to develop two
Step 2: Define a class with two integer data fields’ numerator and different classes that implements this interface, one using array and the
denominator. other using linked-list.
Step 3: Define a constructor to initialize the rational number and to
simplify it. ALGORITHM:
Step 4: Define methods to perform the basic arithmetic operations such
as addition, subtraction, multiplication, division and reciprocal. Step 1: Start the program.
Step 5: Call the appropriate functions with the corresponding arguments Step 2: Design an interface for Stack ADT with functions push, pop and
and display the result. display.
Step 6: Stop the program. Step 3: Define a class to implement the stack using array.
Step 4: Define the functions of the interface accordingly and handle the
RESULT: stack overflow and underflow exceptions.
Step 5: Define a class to implement the stack using linked list.
Thus the program to develop a rational number class with Step 6: Define the functions of the interface accordingly and handle the
methods to perform the basic arithmetic operations was executed and exceptions.
the output was verified successfully. Step 7: Stop the program.
RESULT:
EX: NO. 2 Date class in Java
Thus the program to implement Stack ADT using array and
DATE: linked list was executed and the output was verified successfully.
To develop Date class in Java similar to the one available in java.util DATE:
package. Use JavaDoc comments.
AIM:
ALGORITHM:
To design a Vehicle class hierarchy in Java and to demonstrate
Step 1: Start the program. polymorphism.
Step 2: Define an object today to the Date class and store the current
date in that object. ALGORITHM:
Step 3: Change the Date Format to Short, Long and Medium and display
the date. Step 1: Start the program.
Step 4: Convert the Date to String and print it. Step 2: Define a class Vehicle with fields register no. and model.
Step 5: Stop the program. Step 3: Define a method display which displays all the data fields.
Step 4: Define the classes namely Twowheeler, Threewheeler and
RESULT: Fourwheeler as subclasses of Vehicle class.
Step 5: These subclasses defines a method named display that overrides
Thus the program to develop a Date class was executed and the super class method.
the output was verified successfully. Step 6: Create objects for the subclasses and call the appropriate
methods.
EX: NO. 3 Lisp-like list in Java Step 7: Stop the program.
DATE: RESULT:
Step 1: Start the programs. Thus the program to print the prime numbers in the Fibonacci
Step 2: Define a class Currency as an abstract class with abstract series using multithreading was executed and the output was verified
methods. successfully.
Step 3: Define the classes Rupee and Dollar as subclasses of Currency.
Step 4: Define the abstract methods of the super class accordingly in EXP: NO. 9 Simple OPAC system for library
each subclass.
Step 5: The dollar value is converted to equivalent rupee value within a DATE:
method of Dollar class.
Step 6: Define a class StoreCurrency that randomly generates objects of AIM:
Rupee and Dollar classes.
Step 7: These objects are written into a file named currency using object To develop a simple OPAC system for library using event-
serialization. driven and concurrent programming paradigms of Java. JDBC is used to
Step 8: Define a class ReadCurrency that reads the objects from the file connect to a back-end database.
currency, and displays them.
Step 9: Stop the programs. ALGORITHM: