Chapter 9 : Objects and Classes
Give
both traditional and Object Oriented approach
solution for the following problems.
1. Write a java program that reads
the length and height of a rectangle and computes its area and parameter using
the following formulas:-
Area = length x height
Perimeter = 2 x (length +
height)
OOP:
2. Write a java program that reads
the height of a cube and computes its
area and parameter using the following formulas:-
Area
= height2
Perimeter
= 4 x height
TRA:
3. Write a program that reads in the radius and length
of a cylinder and computes its volume using the following formulas:
Area = radius * radius * 3.14
Volume = area * length
TRA:
No comments:
Post a Comment