Aryan Bhatia - Practical File Java
Aryan Bhatia - Practical File Java
Aryan Bhatia - Practical File Java
TECHNOLOGY
PRACTICAL FILE
Submitted by
2 Write a program to print your details such as your name, class, section and roll
number.
3 Write a program to take input of marks of different subjects from user and
calculate student’s total and percentage.
4 Write a program to take the radius of the circle fromuser and print its area and
circumference.
5 Write a program to take the principal, rate and time fromuser and display the
calculated simple interest.
6 Write a program to input the side of a cubical box and print its volume.
7 Write a program to take a number as an input from the user, display the cube of
the digit in the units place.
8 Write a program to input a number from the user and display whether it is even
or not.
9 Write a program to input the marks in 5 subjects. Calculate the percentage and
print the remark based on it:
% Remark
>=80 Excellent
>=60 and < 80 Very Good
>=40 and <;60 Good
<40 Work Hard
10 Write a menu driven program to accept 2 numbers from the user and perform the
four arithmetic operations (+,-,*,/) on the two numbers.
11 Write a Java program to accept a number and display all even numbers till that
number.
12 Write a program to accept a number from the user and display its factorial.
13 Write a program to input a number and print the Fibonacci series till
that number.
Sample Input : Enter a number : 10
Sample Output : 0 1 1 2 3 5 8
14 Write a program to display the Armstrong numbers between 1 to n, where n is
input by the user.
Sample Input : Enter the number : 500
Sample Output : 153
An armstrong number is one whose sum of cubes of the digits of that number is
equal to the number itself. For example 153 is an armstrong number 153 =
(1*1*1)+(5*5*5)+(3*3*3).
15 Write a program to Input the elements of an array and display the sum of all the
numbers of the array.
16 Write a program to input the numbers of an array of size 5 and display the
maximum value of the array.
19 Write a program in Java to search for an element in a number array. The search
key must be accepted from the user.
20 Write a program to accept a String from user and show the string in the following
format.
Upper case
Lower case
Check length of the string
Replace String with a new string
Check index of a character.
23 Question on Database
Q1 Write a program to Print Hello World in Java .
Q2 Write a program to print your details such as your name, class, section and roll
number.
Q3 Write a program to take input of marks of different subjects from the user and
calculate student’s total and percentage.
Q4 Write a program to take the radius of the circle fromuser and print its area and
circumference.
Q5 Write a program to take the principal, rate and time from user and display the
calculated simple interest.
Q6 Write a program to input the side of a cubical box and print its volume.
Q7 Write a program to take a number as an input from the user, display the cube of
the digit in the units place.
Q8 Write a program to input a number from the user and display whether it is even
or not.
Q9 Write a program to input the marks in 5 subjects. Calculate the percentage and
print the remark based on it:
% Remark
>=80 Excellent
>=60 and < 80 Very Good
>=40 and <;60 Good
<40 Work Hard
Q10 Write a menu driven program to accept 2 numbers from the user and perform the
four arithmetic operations (+,-,*,/) on the two number
Q11 Write a Java program to accept a number and display all even numbers till that number.
Q12 Write a program to accept a number from the user and display its factorial.
Q13 Write a program to input a number and print the Fibonacci series till
that number.
Sample Input : Enter a number : 10
Sample Output : 0 1 1 2 3 5 8
Q14 Write a program to display the Armstrong numbers between 1 to n, where n is input by the
user.
Sample Input : Enter the number : 500
Sample Output : 153
An armstrong number is one whose sum of cubes of the digits of that number is equal
to the number itself. For example 153 is an armstrong number 153 =
(1*1*1)+(5*5*5)+(3*3*3).
Q15 Write a program to Input the elements of an array and display the sum of all the
numbers of the array.
Q16 Write a program to input the numbers of an array of size 5 and display the maximum
value of the array.
Q17 Write a program to design a class book. Display details of a book using Constructor.
Q18 Define a class HandSet with following description:
Data Members
· Make of type string
· Model of type string
· Price of type long int
· Rating of type char
Member Functions
Constructor to assign values to data members
Write a program to show Function Display ( ) to display the details of an object of
HandSet type.
Write a program to show Function RetPrice ( ) to return the value of price of an object
of HandSet type
Q19 Write a program in Java to search for an element in a number array. The search
key must be accepted from the user.
Q20 Write a program to accept a String from user and show the string in the following
format.
a) Upper case
b) Lower case
c) Check length of the string
d) Replace String with a new string
e) Check index of a character.
Q21 Write a program in Java to enable user to handle divide by zero exception.
Q22 Write a program to show usage of Threads in Java.
Q23 Consider the table Employee and Answer the following queries .
Table Name: Employee