Assignment No.
-3
1. Write a program in Java to take input in a 4x4 DDA, then display it in a matrix format. Now
find the left and right diagonals and display.
Sample input:
4652
5310
2343
5242
Sample output:
Left Diagonal items
4,3,4,2
Right Diagonal items
2,1,3,5
2 Write an overloaded method to calculate the area of 4 different Shapes (triangle, square,
rectangle, circle) following are the sample prototypes.
int area (int l, int b)
int area (int s)
int area (double r)
int area (int a, int b, int c)
Also write the main () method to invoke the Overloaded methods.
3. Write a program to take input in a single dimensional arrays one with even numbers and
another with add numbers. Now merge first 3 items from both arrays, into another Single
dimensional array, Display the merged array.
4. Write a program in Java to input in a 3x3 array, then check if the matrix is an identical matrix
or not.
Hint: 1 0 0
0 1 0
0 0 1
is an identical matrix
5. Write a program in Java to check if a triangle is possible to draw, if possible then display the
type of triangle to be drawn with respect to the number of side. The method will be
non-returnable.
Method name
triangle (int, int, int).
Assignment: 4
1. Write a program in Java to create a method reverse (int) and check if a given number is an
adam number or not.
[Hint: Input Number: 12
Reverse of input is 21
Square of input is 144
Reverse of 144 is 441
Square of 21 is 441
as both square of reverse number and reverse of square of the original number is 441,so 12 is
Adam number.]
2. Write a to create a method pronic (int) and check if a given number is a pronic number.
3. Write a program to create a method factorial(int) and calculate the following
x=n! /(n-r)!
where n and r input given by user
4. Write a program to create a method Harshad(int n) to check if a number is a Harshad
Number.
5.Write a program to use a class Student with the following specifications.
Data member:S_name, S_Eng, S_2ndL, S_Math, S_CompA, S_Hist
Method: void input()
to take Student's name and Marks in English, Bengali/Hindi, Math, History, Computer App
Use another class Progress_Report which inherits from class Student with the following
specifications.
Data members:prcnt, prcnt_L
Method: calculate()
to calculate the total percentage
of the student,
Language ()
to calculate the percentage of the Student in both Language.
Display ()
Display the name of the Student marks in all 5 subjects along with total percentage and
Language percentage.
Project submission date: 07/11/2023
Instructions :
Cover page printout with following heading:
school name,
topic : Computer Applications Project file
Student name,
class,
section,
roll number,
UID number
Page arrangement :
Acknowledgement
Index table
Introduction about Java and about OOP
Problem statement (Question)
Handwritten Source code
Screenshot of Typed Source code in BlueJ(after compilation if syntax error)
Screenshot of the output window. (left side white page according to the problem)
Data table(end of each program)
Acknowledgement
[Make Both assignment and submit together with Proper Label]