Lab Exercise-1
(Basics, Operators, Loops, Classes & Methods)
1. Write a program to print the prime numbers between 1 to 1oo. In java
2. Write a program to print the tables of the numbers that comes between two numbers, and these numbers should be inputted from the keyboard.
3. Write a program that converts the following:- int to char, char to int, string into a number.
4. Write a program to display Floyd's Triangle
1
0 1
0 1 0
1 0 1 0
1 0 1 0 1
5. Design a class to represent a bank account. Include the following members:
Data Members
a. ->Name of the depositor
b. ->Account Number
c. ->Type of Account
d. ->Balance amount in the account
Methods
a. ->To assign intial values(with method and not with constructor)
b. ->To deposit an amount
(Include computation of Interest for saving a/c)
c. ->To withdraw an amount after checking balance
(check minimum balance if necessary for current account impose penalty)
d. ->To display the name and balance
6. Create a class Account that stores customer name, account number and type of account. From this derive the classes Curr-acct and Sav-acct to make them more specific to their requirements. Include the necessary methods in order to achieve the above mention task.
7. Write a program to take two doubles as an input and determines if the first is a multiple of a second.
8. Write a for loop that will print out all the multiple of 3 from 3 to 36, that is 3, 6, 9, 12, 15, 18, 21,24, 27, 30, 33, 36.
9. A Java Program to show an example of overloading constructors in a class to initialize its data members.
Lab Exercise-2
(Array, Structures)
1. Write a program to read the table elements into a two-dimensional array temperature and to find the city and day corresponding to
a. the highest temperature and
b. the lowest temperature
2. Write a program to calculate multiplication of any matrix A and B entered by the user.
3. Write a program that finds the largest value in an array of integers.
4. Suppose that a class, Employee is defined as follows:
class Employee
{ String lastName;
String FirstName;
double hourlywage;
int yearswitchCompany;
} Suppose that data ab out 100 employees is already stored in an array.
Employee[] employeeData = new employee[100];
Write a code segment that will output the firstname, lastname, and hourly wage of each employee who has been with the company for 20 years or more.
5. Write a program for COMMAND LINE ARGUMENT.
Lab Exercise-3
(Multithreaded Programming)
1. Write a program to demonstrate that how a thread is created.
2. Write a program to create Threads with names and assigning different works for different threads.
3. Write a program that has more than one thread, change the name of the thread, set the different priorities to the threads.
4. Write a program to create a consumer thread and goods thread using the implementation of Runnable interface.
5. Write a program to create two or more threads by extending the Thread class.
Lab Exercise- 4
(I/O, Files)
1. Write a program to print a string on Standard Output Device.
2. Write a Program to declare and initialize Integer variables and print them on the Standard Output Device.
3. Write a program to show the use of Increment and Decrement Operators.
4. Write a program to read input from the Standard Input Device.
5. A Java Program to declare and initialize Boolean variables and print them on the Standard Output Device.
6. Write a program that will show, how can I read from, and write to, files in java?
7. Write a program to enter file name and calculate number to lines, words and characters in this file.
8. Write a program for reading files in text mode.
9. Write a program for creating files in byte mode
10. Write a program to copy one file into another. The names of both files must be specified on the command line.
Lab Exercise-5
(String Handling)
1. Write a program to check the inputted character from the console is in capital letter or small letter.
2. Write a program to check whether string is palindrome or not.
3. Write a class that keeps a running total of all characters passed to it (one at a time) and throws an exception if it is passed a non-alphabetic character.
4. Write a program, which will read a string and rewrite it in the alphabetical order.
for example: the word STRING should be written as GINRST.
5. Write a Java Program to declare, initialize and print a StringBuffer object.
6. Write a Java Program to show an example of extraction of characters from a StringBuffer objects.
7. Write a method called delete (String str,int m) that returns the input string with the mth element removed.
8. Write a program to extract a portion of a character string and print the extracted string. Assume that m characters are extracted, string with the nth character.
Lab Exercise-6
(Data Structure through Java)
1. Write a program to sort an array using BUBBLE SORT.
2. Write a program to sort an array using INSERTION SORT.
3. Write a program to search an element using BINARY SEARCH.
4. Write a program to search an element using LINEAR SEARCH.
5. Write a program to perform MERGE SORT.
6. Write a program to perform QUICK SORT on an array.
7. Write a program to perform SELECTION SORT on an array.
Lab Exercise-7
(Networking, RMI)
1. Write a program using Socket and ServerSocket to implement client server architecture.
2. Write a program to implement a chat server application using RMI.
Lab Exercise-8
(Applet, AWT, Swing, Event Handling)
1. Write a Program to display alternate filled and empty circle using applet.
2. Write a program to display the Applet Life Cycle Demo.
3. Write a program to draw an oval inside a rectangle on the applet.
4. Write a small applet program to calculate the distance between two points.
5. Write a program to handle Window Events using adapter class and without using adapter class.
6. Write a program to handle Keyboard events using adapter class and without using adapter class.
7. Write a program to handle Mouse events using adapter class and without using adapter class.
8. Write a program to make a menu name color that contains three colors depends upon the choice of the user. Handle the event so that the color of the container changed according to the Menu Tab.
Lab Exercise-9
(Java Database Connectivity)
1. Write a program to read the data from the database.
2. Write a program to read the specific record from the database.
3. Write a program to save data in a database using Swing Application.
4. Write a program to save data and update it according to the requirement using the swing application.
5. Attach the home assignment module at the end of this exercise.
6. Write a program to design the following module and connect it with the database to register a new account.