
CSE 283 Introduction to Object Oriented DesignBarbara Nostrand, Ph.D. 
CSE 283 Labs 

Lab 2: Projects
Objectives1. Practice designing a program.
IntroductionYour instructor will assign you one of the problems below. To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Following the pattern in the lab exercise, first, design your program by specifying its behavior, identifying the objects and operations it needs to solve the problem, and then organizing the objects and operations into an algorithm. Then code your design in Java using stepwise translation. Finally, test your program thoroughly. In the descriptions below (and elsewhere in this manual), we use the notation x^{y} to denote x raised to the power of y. PI is a transcendental number which is equal to the ratio between the circumferance and diameter of a circle. PI is approximately equal to π=3.1415926...
Projects2.1. Write a program called Circle to find the circumference and area of any circle. The formulas for these quantities are as follows: circumference = 2 * p * radius. area = p * radius^{2}. 2.2. Write a program called Cylinder to find the side surface area and volume of any regular cylinder. The formulas for these quantities are as follows: sideSurfaceArea = 2 * p * radius * height. volume = p * radius^{2} * height. 2.3. Write a program called Ellipse to find the circumference and area of any regular ellipse. The formulas for these quantities are as follows: circumference = 2 * p * the square root of (((height/2)^{2}) + (width/2)^{2})/2). area = p * height/2 * width/2. 2.4. Write a program called Sphere to find the surface area and volume of any sphere. The formulas for these quantities are as follows: surface area = 4 * p * radius^{2}. volume = 4/3 * p * radius^{3}.

Home


Last modified: 2007 OCT 28 bnostran@syr.edu 