Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Aryan Bhatia - Practical File Java

Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

INFORMATION

TECHNOLOGY

PRACTICAL FILE

Submitted by

Name : ARYAN BHATIA


Roll No: 9
Class/Sec :XII-J
Board Roll No:
INDEX
S.no Topic Signature

1 Write a program to Print Hello World in Java.

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.

17 Write a program to design a class book. Display details of a book using


Constructor.

18 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

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.

21 Write a program in Java to enable user to handle divide by zero exception.

22 Write a program to show usage of Threads in Java.

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

Employee_Id Employee_Name Job_Title Salary Bonus Age Manager_Id


1201 Divya President 50000 NULL 29 NULL
1205 Amyra Manager 30000 2500 26 1201
1211 Rahul Analyst 20000 1500 23 1205
1213 Manish Salesman 15000 NULL 22 1205
1216 Megha Analyst 22000 1300 25 1201
1217 Mohit Salesman 16000 NULL 22 1205

Write the SQL commands for the following:


a) Create the above table.
b) Insert values as shown.
c) Delete the Employee having Employee_Id 1217.
d) Update the salary of “Amyra” to 40000.
e) Alter the table Employee so that NULL values are not allowed for the age
column.
f) Write a query to display the names and salaries of those employees whose
salaries are greater than 20000.
g) Write a query to display the details of those employees who are not getting any
bonus.
h) Write a query to display the names of employees whose name contains “a” as
the last alphabet.
i) Write a query to display the name and job title of those employees whose
Manager_Id is 1201.
j) Write a query to display the name and job title of those employees whose
manager is “Amyra” (Employee_Id=1205)
k) Write a query to display the name and job title of those employees aged
between 26 and 30 years (both inclusive).

You might also like