JAVA Programming Lab
B-tech 4th Semester
1. Write a program to find the area of a triangle when three sides are given.
2. Using switch and case statements write a program to add, subtract, multiplies and divides the two numbers
3. Write a program to print all the prime numbers between n and m.
4. Write a program to add the two matrices.
5. A cloth showroom has announced the following discounts on purchase of items.
ITEM DISCOUNT
T Shirt 10%
Silk sari 30%
Baba suit 40%
Trousers 15%
Cost of the items can be assumed.
Write a program using switch and if statement to compute the net amount to be paid by a customer.
6. Design and test a class to represent a bank account. Include the following members.
DATA MEMBERS:
Name of the depositor, Account number and type of account, Balance Amount.
METHODS;
a) To assign initial values.
b) To deposit an amount
c) To withdraw after checking balance.
d) To display the name and balance.
7. Write a class Box with the variable width, depth and height and constructor to assigning the values for these variables and a method to find the volume of the box and also write the main program, which creates the box object, and find the volume of the box. Print the result on the screen
8. Write a program to demonstrate multiple inheritances.
9. Write a program to illustrate importing classes from other packages.
10. Write a program for creating threads using Runnable interface.
11. Write a program to illustrate the use of try and catch for exception handling.
12. Write a program to demonstrate method overriding.