MCA 454 Java Lab Assignment 1
MCA 454 Java Lab Assignment 1
MCA 454 Java Lab Assignment 1
On
MCA 454
Advance Java Lab
Submitted To:
Mr. Deependra Rastogi
Submitted By:
Student
Name :
Assistant Professor
Enrollment No. :
Course :
Section:
LAB ASSIGMENT NAME Java Programming
LAB ASSIGMENT NO. - 1
S No
Program Name
Page
No
Date
Sign
Remar
k
Example
INPUT : 15
BINARY EQUIVALENT : 1111
NO. OF 1s : 4
OUTPUT : EVIL NUMBER
A bank intends to design a program to
display the denomination of an input
amount, upto 5 digits. The available
denominations with the bank are of
Example 1:
INPUT: 14836
OUTPUT: ONE FOUR EIGHT THREE SIX
DENOMINATION:
1000 X 14 =14000
500 X 1 =500
100 X 3 =300
50 X 1 =50
5 X 1 =5
1 X 1 =1
EXAMPLE 2:
INPUT: 235001
OUTPUT: INVALID AMOUNT
Write a program which contains 10
element and sort it using bubble sort,
selection
sort
and
insertion
sort
technique.
Write a program to input a list of integers
in an array and arrange them in a way
similar to the to-and-fro movement of a
Pendulum.
The minimum element out of the list of
integers, must come in center position of
array. The number in the ascending order
next to the minimum, goes to the left,
the next higher number goes to the right
of minimum number and it continues. As
higher numbers are reached, one goes to
either side of the minimum value in a toand-fro manner similar to that of a
Pendulum.
10
Example:
INPUT 1 2 3 4 5
OUTPUT 5 3 1 2 4
INPUT 11 12 31 14 5
OUTPUT 31 12 5 11 14
Write a program to declare a square
matrix A[ ][ ] of order n. Allow the user
to input positive integers into this matrix.
Perform the following tasks on the
matrix:
(i) Output the original matrix.
(ii) Find the SADDLE POINT for the
matrix. If the matrix has no saddle
point, output the message NO
SADDLE POINT.
[Note: A saddle point is an element of
the matrix such that it is the minimum
element for the row to which it belongs
and the maximum element for the
column to which it belongs. Saddle point
for a given matrix is always unique.]
Example: In the Matrix
456
789
513
Saddle point = 7 because it is the
minimum element of row 2 and
maximum element of column 1
Write a Program in Java to fill a square
matrix of size n*n in a spiral fashion
(from the inside) with natural numbers
from 1 to n*n, taking n as input.
For example: if n = 5, then n*n = 25,
hence the array will be filled as given
below.
11
12
ENTER SIZE : 4
INPUT : FIRST CHARACTER : *
SECOND CHARACTER : ?
THIRD CHARACTER : #
OUTPUT :
#**#
?##?
?##?
#**#
Example 2
ENTER SIZE : 5
INPUT : FIRST CHARACTER : $
SECOND CHARACTER : !
THIRD CHARACTER : @
OUTPUT :
@$ $ $@
! @$@!
! !@ ! !
! @$@!
@$$ $@
Example 3
ENTER SIZE : 65
OUTPUT : SIZE OUT OF RANGE