You are on page 1of 3

JAVA Lab Programs

1. Write a java application that takes an integer number as input from


command line and computes the sum of digits and number of digits

2. WAP to enter age to find out person is eligible to vote or not


3. Enter a number and check whether its Armstrong or not
4. WAP to enter three numbers and check the smallest of 3 numbers
5. WAP to show use of Bitwise and Logical Operators
6. WAP to convert temperature given in Fahrenheit to Celsius using Explicit
type conversion
7. Print patterns
8. Calculate electricity bill
9. WAP to display all prime numbers in range
10.Enter a no and check whether the number prime or not
11.WAP that accepts input cost for 3 products as decimal and print sum to
nearest integer
12.WAP to enter a number and print sum of digits and reverse the number
13.WAP to print Fibonacci series up to given number of terms
14.WAP to calculate Factorial of a number
15.Finding the Sales Amount.
You have just started a sales job in a department store. Your pay consists
of a base salary and a commission. The base salary is $5,000. The scheme
shown below is used to determine the commission rate.
Sales Amount Commission Rate
$0.01—$5,000 8 percent
$5,000.01-$10,000 10 percent
$10,000.01 and above 12 percent
Your goal is to earn $30,000 in a year. Write a program that will find out
the minimum amount of sales you have to generate in order to make
$30,000.

16.WAP to check whether a given character is vowel or not


17.The program receives 6 numbers from the keyboard, finds the largest
number and counts the occurrence of the largest number entered from the
keyboard.
18.WAP to merge two arrays.
19.WAP to multiply two matrices
20.WAP to enter elements in an array and print its transpose matrix
21.WAP to sort five numbers in an array. Pass the array as an argument to a
method
22.Write a program to add and subtract 2 complex numbers using classes
23.Write a program that calculates the total score for students in a class.
Suppose the scores are stored in a three-dimensional array named scores.
The first index in scores refers to a student, the second refers to an exam,
and the third refers to the part of the exam. Suppose there are 7 students,
5 exams, and each exam has two parts--the multiple-choice part and the
programming part. So, scores[i][j][0] represents the score on the multiple-
choice part for the i’s student on the j’s exam. Your program displays the
total score for each student

24.Implement and test the binary search method. The program first creates
an array of 10 elements of int type. It displays this array and then prompts
the user to enter a key for testing binary search

25.Create a Date class which consists of fields Day, Month and Year.
Include Appropriate Constuctors and a method NextDay() which
increments the day by 1 and then displays the date in proper format day-
month-year. Check the validity of date.

26.WAP to implement method overloading and overriding.

27.WAP to implement a program that maintains bank account information of


various customers. Modify the bank account class to throw
IllegalArgumentException when the account is constructed with negative
balance, when negative amount is deposited or an amount which is not
between 0 and current balance is withdrawn. Write a test program that
causes all 3 exceptions to occur that catches them all.

28.WAP to make use of length(), charAt(), concat(), indexOf(),


lastIndexOf() functions.
29.WAP to make use of various methods of StringBuffer class.
30.Design an application for Hospital Management system. Create the
following classes:
Person- name, dob, gender
Doctor-specialization
Patient- caseNo, disease,doa(date of admission), dod(date of
discharge), bno
31.WAP to create two threads by implementing Runnable Interface. One
thread displays "X" every 2000 ms and other display "Y" every 3000 ms.
32.WAP to show the usage of a Package.
33.WAP to make 2 classes using Interface.
34. WAP to implement static and local inner classes.
35.WAP to make an applet implementing card layout.
36.Create an applet which accepts the messages as parameter and
scrolls the message
37.WAP to print a table of any no. inside the applet
38.WAP to display student details such as name, roll number, marks etc in
an applet window. Provide these details through html file(param,
getparam method)
39.Write an applet to change background colour using three scroll bars
representing colours red, green and blue respectively
40.WAP to accept no. From user and convert to binary by using wrapper
class methods
41.WAP that has two threads where one thread prints table of 5 and other
thread prints a string 10 times
42. WAP in java for creating the following AWT list
Java list AWT
What is your hobby?

 Reading
 Cricket
 Dancing
 Football

Cricket

43. WAP in java to create menu using swing

44. Demonstrate use of factory methods for InetAddress class.


45. Demonstrate use of getbyname(),gethostname(),gethostaddress() methods for InetAddress
class
46.Create a program making use of JDBC prepared staements
47.Create a Servlet which implement doGet() and doPost() method of HTTP
Servlet
48.Create a Servlet which implements Generic Servlet
49.WAP application to connect to database table emp(id,name,design) and
display the record of the table
50.i)WAP to copy contents of one file to another

ii)count the number of words in a file

iii)WAP to accept two files names as command line argument. Copy only
those lines from the first file to second file which contains the word
“computer”

You might also like