Programming assignment

Programming assignment

Programming assignment: textbook exercise 10.13 on page 439. Additionally, incorporate an interface into your program and make sure it serves a purpose (your program should not run without it). Within your source code, address /* within comments */ the concepts in four of the eight exercises from 10.4 to 10.11 on page 439. You are to substantiate your answers by referring to relevant aspects of your code. Make sure to include in your code comments the exercise number! 

Please put source code for these programming tasks in a single folder, compress the folder (as .zip or .jar) and upload to dropbox. (Each project file may optionally be made an independent executable jar file.) FYI: 

A single file per class is not required. However, it simplifies visualizing short programs. That usually means no access modifier on non-driver classes, assuming the driver class does not wrap the other classes. 

Programming exercise point distribution:

-Program compiles – 10%

-Program runs as expected – 10%

-Code addresses components of exercise 10.13 – 15%

-Has object created via interface – 10%

Adequate Documentation: 

-Your name – 5%

-The date – 5%

-Program name and purpose/short description – 5%

-Address concepts in four of the eight exercises from 10.4 to 10.11 on page 439 –


10.13 (Project:

Shape Hierarchy) Implement the Shape hierarchy shown in Fig. 9.3. Each TwoDimensionalShape should contain method getArea to calculate the area of the two-dimensional shape. Each ThreeDimensionalShape should have methods getArea and getVolume to calculate the surface area and volume, respectively, of the three-dimensional shape.

Create a program that uses an array of Shape references to objects of each concrete class in the hierarchy. The program should print a text description of the object to which each array element refers. Also, in the loop that processes all the shapes in the array, determine whether each shape is a TwoDimensionalShape or a ThreeDimensionalShape. If it’s a TwoDimensionalShape, display its area. If it’s a ThreeDimensionalShape, display its area and volume.

Powered by