You are on page 1of 3

INDEX

S. Program Pg.
No No.
.
1. Write a simple java program to print “Hello World”. 5
2. WAP to find the square root of any number using Math function. 5
3. WAP to find the roots of a quadratic equation and take input from the user. 6
4. WAP in java to calculate room area. 9
5. Write a program to check whether the number is odd or even. 10
6. A cloth showroom has announced the following seasonal discounts on 11
purchase of items:

WAP using switch and if statements to compute the net amount to be paid by a
customer.
7. WAP that will read the value of x and evaluate the following function- 15
{ 1 , for x > 0 }
y = { 0 , for x = 0 }
{ -1 , for x < 0 } using
(a) Nested if statements
(b) Else if statements, and
(c) Conditional operator ?:
8. WAP in java to input names and marks of students and display them. 19
9. An educational institution wishes to maintain a database of its employees. 22
The database is divided into a number of classes whose hierarchical
relationships are shown below. The figure also shows the minimum
information required for each class. Specify all the classes and define
methods to create the database and retrieve individual information as and
when required.
10. Assume that a bank maintains two kinds of account for its customers, one 27
called savings account and the other current account. The savings account
provides compound interest and withdrawal facilities but no check book
facility. The current account provides check book facility but no interest.
Current account holders should also maintain a minimum balance and if the
balance falls below this level, a service charged is imposed.
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 following tasks: (a) Accept deposit from a customer and
update the balance. (b)Display the balance. (c) Compute and deposit interest.
(d) Permit withdrawal and update the balance. (e) Check for the minimum
balance, impose penalty, if necessary, and update the balance.
11. WAP in java to implement inheritance and interfaces. 35
12. WAP to implement multiple inheritance according to a given diagram. 38
13. WAP on exception handling. 40
14. WAP to print factorial of a number. 41
15. WAP to convert temperature from degree F to degree C. 42
16. WAP to implement inheritance. 43
17. WAP in java to print maximum temperature of a city for a particular day. 45
18. WAP in java to merge two sorted arrays. 47
19. WAP to throw your own exception. (Myexception- Exception for a number 49
too small).
20. WAP to implement Thread methods. 51
21. WAP to create Threads using Runnable interface. 54
22. WAP to print the cumulative sum of numbers entered. 57
23. WAP for fitting a straight line through a set of pints (xi,yi) where i=1,2, ...,n. 58
The straight-line equation is,
y=mx+c and the value of m and c are given by
m= (nΣ(xiyi) - ( Σxi)( Σyi))/(n( Σxi 2 ) - ( Σyi) 2 )
c= (Σyi - mΣxi)/n
24. WAP to determine if a character is a digit, letter, whitespace, uppercase, or 60
lowercase.
25. WAP that accepts a shopping list of five items from the command line and 61
stores them in a vector.
26. WAP that accepts a shopping list of five items from the command line and 63
stores them in a vector. Modify the program to accomplish the following:
• To delete an item in the list.
• To add an item at a specific location in the list.
• To add an item at the end of the list.
• To print the contents of the vector.
27. Write a program to calculate the simple interest . Take input from the user 67
using buffered reader class. Create two separate methods for calculating the
input and printing the output.
28. WAP which will read a string and rewrite it in the alphabetical order. 69
29. WAP which will read a text and count all occurrences of a particular word. 70
30. WAP in java to sort a string. 71

You might also like