Tshri Vile Parle Kelvani Mandal'S D. J. Sanghvi College of Engineering Department of Information Technology Semester: Iii Subject: Java Programming Lab
Tshri Vile Parle Kelvani Mandal'S D. J. Sanghvi College of Engineering Department of Information Technology Semester: Iii Subject: Java Programming Lab
3. WAP in which a random number generated between 0-1000 is the cash inflow to the person
playing the game. Two people play the game 5 times and the winner is the one whose total
cash is maximum and the program displays the winner
4. WAP to generate 10 random numbers from 15-20 and find their mean
5. In a railway reservation system, a particular bogey is allocated for women passengers. The
bogey comprises of 72 seats. The 1st preference is given to female passengers whose age is
>=65. Passengers can provide their choice of seats that include lower, upper, middle, side
lower, side upper. WAP that allocates seats to the passengers according to their request. If
the number of requests exceeds the capacity of bogey it should give “reservation full”
message
8. Write a program that reads any positive integer n and prints the digits in words. (For
example, if input is 1265 then output is one two six five).
10. WAP to accept a number from command line and print the sum of cube of individual digits
11. WAP to accept a number from command line and check whether it is Armstrong or not
13. Write a program that reads a 4 digit integer and breaks it in a sequence of individual digits
[example: 1691 should be displayed as 1 6 9 1]
15. WOOP in JAVA to find GCD and LCM of two non-negative numbers using EUCLID's
Algorithm
25. WAP in JAVA to compute the distance S fallen by an object in free-fall. The formula is
S=So+Vo*t+1/2*a*t*t
make a table of S for t=0,5,10.............100
26. WAP to accept 5 integers from user and sort in ascending order
WAP to check whether the entered 4 digit number is vampire or not. Combination of digits from this
number forms 2 digit number. When they are multiplied by each other we get the original number.
(1260=21*60)
28.
30. A record of average temperature is prepared for different cities month-wise as shown
below:
Month Jan Feb Mar … … Dec
State
State 1
State 2
….
State 5
WAP to read the data in 2D array and determine the following:
State with highest temperature recorded in the months of April and May
State with lowest temperature recorded in the months of December and January
32. WAP to insert an element into an array at the position specified by the user.
33. WAP in JAVA for fitting a straight line through a set of points (Xi,Yi) i=1,2,......n. The
straight line equation is y=mx+c and the values of m and c are given by...........................
35. WAP to find out number of uppercase & lowercase characters, blank spaces and digits from
the string
36. WAP to capitalize the first character of each words from a given sentence (example:all the
best All The Best)
37. Write a program to accept any string up to 15 characters. Display the elements of string
with their element nos. use toCharArray () function.
39. WAP in which user is asked to enter any 4 words through command Line. These words are
sorted and then displayed
40. WAP to count the frequency of occurrence of a given character in a given line of text
42.
44. WAP to add n strings in a vector array. Input new string and check if it is present in the
vector. If present delete it else add to the vector
45. WAP to add the list of items using vector and delete an item in the list according to users
choice
46. WAP to read 5 names of students name from command line and store them in Vector. Sort
the list in alphabetical order and display using enumeration interface.
47. WAP that uses vector class to add 5 names initially. Display a menu:
Add new name
Delete name
Display name
Based on the choice entered by the user take appropriate action
48. WAP that accepts a shopping list of items and performs the following operations
Add an item at a specified location
Delete an item in the list
Print the contents of the vector
49.
50.
52. WAP to accept a no. and compute the summation of digits recursively
56. WAP to find volume of cube, cylinder and rectangle using function overloading
58. Write a menu driven Java program which read a number and should implement the
following methods
1. factorial()
2. reverse()
3. testArmstrong()
4. testPalindrome()
5. testPrime()
6. fibonacciSeries()
59. Write a Menu driven program in java to implement simple banking application. Application
should read the customer name, account number, initial balance, rate of interest, contact
number and address field etc. Application should have following methods.
1. createAccount()
2. deposit()
3. withdraw()
4. computeInterest()
5. displayBalance()
60. WAP to swap two numbers using call by value and call by reference
61. WAP to count the number of objects made of a particular class using static variable and
static method to display the same
62.
63. WA demonstrative program to illustrate nested class. Define a method in the inner class and
access the same by code outside the outer class(in a class with main())
64. Create a class Rectangle. The class has 2 attributes, length and width, each of which defaults
to 0. It has methods to calculate the perimeter and area of the rectangle. It has set and get
methods for both length and width. The set method should verify that length and width are
floating point numbers larger than 0.0 and less than 20.0
66. WOOP to arrange the names of students in descending order of their total marks, input data
consists of students details such as names, ID.no, marks of maths, physics, chemistry.(Use
array of objects)
67. write a program to read and display details of 10 employees with following specifications:
Data members: Emp_ID, Emp_name, Emp_Sal
Parametrised constructor: to initialise data members of Employee
Member function Display () to display information of all employees
68.
69. WAP to display area of square and rectangle using the concept of overloaded constructor
70.
71. Assume that a bank maintains two kinds of accounts for its customers. The saving account
provides compound interest and withdrawal facilities but no cheque book facility. The
current account provides cheque book facility but no interest. Current account holders
should also maintain a minimum balance and if the balance falls below this level, a service
charge is imposed. Create a class account that stores customer name, account number and
type of account. From this derive the class current account and savings account. Include
methods to achieve the following tasks
accept deposit from a customer and pdate the balance
display the balance
compute and deposit interest
permit withdrawal and update the balance
check for minimum balance, impose penalty if necessary and update the balance
73. Consider a class network given. The class 'Admin' derives information from the class
'Account' which in turn derives information from the 'Person' class. WAP to display the
'Admin' object (use overriding)
Person
Name
Code
Admin
Account
Exp
Pay
74. WAP to display area of square and rectangle. Make use of interface to define templates of
methods to be there in the derived class
75. Design an interface with a method reversal. This method takes a string as input and
returns the reversed string. Create a class that implements the above interface
76. Design an interface with a reverse() that reverses the digits of the number
78. WAP to display volume of sphere and hemisphere using abstract classes
79. WAP to display area of square and triangle using the concept of abstract class
80. Write an abstract class program to calculate area of circle, rectangle and triangle
84. WAP to accept and display month number. Throw NumberFormatException if improper
month number is entered
86. Make your exception class “InvalidMarks” which is thrown when marks obtained by
student exceeds 100
87. WAP that accepts the values of a, b, c and d. Calculate and display ((a+d) + (b*c))/ (b*d).
create user defined exception to display proper message when value of (b*d) is zero
88.
89. WAP that illustrates the output when a –ve number is passed as an argument for sqrt()
method (use exception handling)
90. Create a user defined exception CKECKARGUMENT to check the number of arguments
passed through command line. If the number of arguments is less than 5, throw the
exception else print addition of the five numbers
91. Write a java program to print first 20 prime numbers and 15 Fibonacci numbers by creating
two child threads and also print the total time taken by each thread for the execution.
92. Write java program to create the child thread. Comment on the execution of main and Child
Thread.
93. Write a program to print */*/*/*/*/*/*/*/*/*/ using two child threads. (hint:one thread
responsible for printing * and another for /)
94. WAP in Java to calculate Fibonacci series and Factorial of a number using two child threads
95. WAP to create multiple threads (one may display alphabets and other may display numbers)
96. WAP to illustrate use of isAlive(),sleep() and join() method.Create three classes A,B,C.
create another class "IsAliveJoin" to invoke isAlive() and join() methods for these 3 child
threads
98. WAP to create 3 threads and illustrate the working of synchronization. Two threads deposit
money into the account, whereas 3rd withdraws an amount from the account.
Menu demo
File Edit View
Undo
Cut
Copy
Paste
104. WAP to display a line, circle and arc inside the applet’s visible area
106. WAP to check the font name and font size of string by passing parameter to applet
108. Create a list of vegetables. If you click on one of the items of the list, the item should
be displayed in a textbox
109. WAP using AWT to create a simple calculator
111. Create 2 lists using JList class with a button. On click of that button. All selected items
in 1 list should be copied to another list
112. WAP to display string in different color in an applet. Also draw a filled hexagon in
orange color
113. WAP program to include 2 textfields to enter name and password. Set the echo character
to hide the password letters (uploaded on blackboard…login_awt.java)
114. WA applet program that allows user to choose items out of 6 checkboxes laid out in
default FlowLayout
115. WA applet program in which user is required to enter 1st name, last name and
qualification. On clicking submit button these details should be displayed
116. WA applet with 4 swing buttons with suitable texts on them. When the user presses a
button a message should appear in the label as to which button was pressed by the user
117. WA AWT program to create checkboxes for different courses belonging to a university
such that the course selected will be displayed