[Go to site: main page, start]

0% found this document useful (0 votes)
7 views56 pages

Java Programming Lab Exercises

The document outlines a Java programming lab assignment for BCA students, detailing various programming tasks and exercises. It includes tasks such as printing messages, performing arithmetic operations, implementing control structures, and creating classes for specific functionalities. The document serves as a comprehensive guide for students to practice and demonstrate their Java programming skills.

Uploaded by

rajwinderahirwar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views56 pages

Java Programming Lab Exercises

The document outlines a Java programming lab assignment for BCA students, detailing various programming tasks and exercises. It includes tasks such as printing messages, performing arithmetic operations, implementing control structures, and creating classes for specific functionalities. The document serves as a comprehensive guide for students to practice and demonstrate their Java programming skills.

Uploaded by

rajwinderahirwar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Software Lab IX

(Java Programming)

Submitted to: Submitted by:


Prof. Cheenakshi Rajwinder Ahirwar
(Computer Dept.) Course: BCA 3
Sem: V
Uni. Roll no.: 943367
INDEX
Serial No. Particulars Page No.
1. WAP to print message using escape sequence characters.
2. WAP to swapping of 2 numbers using third variable or without
third variable.
3. WAP to find area of rectangle.
4. WAP to find the simple interest.
5. WAP to print the larger of two numbers entered from the
keyboard using if else statement.
6. WAP to check the divisibility of number a by another number
say b.\
7. A voter is eligible for the elections held in his city. If his age is
atleast 18 years.
Define a class Eligibility Test that checks for the eligibility of a
voter.
8. A cloth showroom has announced the following festival
discount on the purchase of
Items based on total cost of the items purchase:
Cost Discount
<Rs. 2000 5%
Rs. 2000 to Rs. 5000 25%
RS. 5001 to Rs. 10000 35%
Above RS. 10000 50%
WAP to input the total cost and to compute and display the
amount to be paid by the customer after availing the discount
using else if ladder
9. WAP to accept a month number and print the corresponding
month name, make use of switch case.
10. WAP to accept a Consonant and check whether it is Vowel or
Consonant..
11. WAP to print the computed Kinetic Energy by formula K.E = ½
mv2 .
12. WAP to compute the double and half of a where a = 10.92.
13. WAP to find the input of following code:
Int k=5,j=9;
K+=k++ - ++j +k.
14. WAP to find the reverse of number using while statement.
15. WAP to find the sum of the digit of number using while or do
while statement.
16. WAP to check whether number is palindrome or not using do
while statement.
17. A Survey is conducted by welfare association to count the
number of persons in favour and against the government
policies. If a person favours the policy he entered, If a person
is against the policy he entered 2 and if he has no opinion he
enters 0. WAP to count the number of person in each category .
Assume that the number of person under survey are 50.
18. WAP to find the factorial of number using for statement.
19. WAP to print pattern
a
b c
d e f
20. WAP to print pattern
6 5 4 3 2 1
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
21. Define a class having a method check() to check whether an
entered number is a Buzz number or not.
22. Define a class Bank in java with following specifications:
Class name -> Bank
Data members -> name ,id , withdrawal , deposit , balance
Constructor : Default
Members method:-
I. Info() -> to enter the information about the customer.
II. Deposit() -> to deposit the money in the a/c.
III. Withdrawal() -> to withdraw the money from the
account.
IV. Balance() -> to check the balance left in the account.
V. Create a main() method to
a. Accept the values like customer name, customer
id etc from the user.
23. Define a class to check whether an entered number is special
or not( special number = factorial of digits).
24. Define a class to perform arithmetic operators using Methods.
25. Define a class to perform factorial and to check number is
palindrome or not using methods.
26. WAP to perform Method overloading.
27. Write a program to demonstrate constructor overloading.
28. Write a program of pass by value.
29. Write a program of pass by reference.
30. Write a program of this keyword.
31. Write a program of wrapper classes.
32. Write a program to print the reverse or an array.
33. Write a program to print the sum of rows & columns in 2D array.
34. Write a program of string handling functions.
35. WAP of inheritance.
36. WAP of polymorphism at run time in overriding.
37. WAP to show the use of super keyword.
38. WAP of interface to show the concept of Multiple-inheritance.
39. WAP of user defined package with in package.
40. WAP of Exceptional Handling with finally block.
41. WAP of multithreading in which create threads using thread
class.
42. WAP of Multithreading using Runnable Interface.
1. WAP to print message using escape sequence characters.

OUTPUT
2. WAP to swapping of 2 numbers using third variable or without third variable.

2.2 . WAP to swapping of 2 numbers without using third variable.

OUTPUT
3. WAP to find area of rectangle.

OUTPUT
4. WAP to find the simple interest

OUTPUT
5. WAP to print the larger of two numbers entered from the keyboard using if else
statement.

OUTPUT
6. WAP to check the divisibility of number a by another number say b.\

OUTPUT
7. A voter is eligible to vote for the elections held in his city. If his age is atleast 18
years. Define a class Eligibility Test that checks for the eligibility of a voter.

OUTPUT
8. A Cloth Showroom has announced the following festival discount on the
purchase of
Items based on total cost of the items purchase.
Cost Discount
< Rs.2000 5%
Rs.2000 to Rs.5000 25%
Rs.5001 t0 Rs.10000 35%
Above Rs.10000 50%
WAP to input the total cost and to compute and display the amount to be paid by
the Customer after availing the discount using else if ladder.
OUTPUT
9. WAP to accept a month number and print the corresponding month name . Make
use of switch case.
OUTPUT
10. WAP to accept a Consonant and checks whether it is Vowel or Consonant.

OUTPUT
11. WAP that prints the computed Kinetic Energy by the formula K.E = ½ mv2

OUTPUT
12. WAP that computes the double and half of a where a=10.92.

OUTPUT
13. WAP to find the output of following code
int k=5 , j=9
k += k++ - ++j +k.

OUTPUT
14 . WAP to find the reverse of number using while statement.

OUTPUT
15 . WAP to find the sum of the digit if number using while or do while statement.
OUTPUT
16 . WAP to check whether number is palindrome or not using do while statement.

OUTPUT
17. A Survey is conducted by welfare association to count the number of persons in
favour and against the government policies. If a person favours the policy he entered, If
a person is against the policy he entered 2 and if he has no opinion he enters 0. WAP to
count the number of person in each category .Assume that the number of person under
survey are 50.

Output
18. WAP to find the factorial of number using for statement.

Output
19. WAP to print pattern
a
b c
d e f

Output
20. WAP to print pattern

6 5 4 32 1
5 4 3 21
4 3 2 1
3 2 1
2 1
1
Output
21. Define a class having a method check() to check whether an entered number is a
Buzz number or not.

Output
22. Define a class Bank in java with following specifications:
Output
23. Define a class to check whether an entered number is special or not( special
number = factorial of digits).

Output
24. Define a class to perform arithmetic operators using Methods.

Output
25. Define a class to perform factorial and to check number is palindrome or not using
methods

Output
26. WAP to perform Method overloading.

Output
27. Write a program to demonstrate constructor overloading.

Output
28. Write a program of pass by value.

Output
29. Write a program of pass by reference.

Output
30. Write a program of this keyword.

Output
31. Write a program of wrapper classes.

Output
32. Write a program to print the reverse or an array.

Output
33. Write a program to print the sum of rows & columns in 2D array.

Output
34. Write a program of string handling functions.

Output
35. WAP of inheritance.

35.1 Single Inheritence

Output
35.2. Multileve Inheritence

Output
35.3. Hierarical Inheritence

Output
35.4. Hybrid Inheritence

Output
36. WAP of polymorphism at run time in overriding.

Output
37. WAP to show the use of super keyword.

Output
38. WAP of interface to show the concept of Multiple-inheritance.

Output
39. WAP of user defined package with in package.

Output
40. WAP of Exceptional Handling with finally block.

Output
40.2 WAP of Exceptional Handling with finally block.

Output
41. WAP of multithreading in which create threads using thread class.

Output
42. WAP of Multithreading using Runnable Interface.

Output

You might also like