Fall 2012: Due 10/11/2012 1. Write a program in Java to calculate the volume of
ID: 3651745 • Letter: F
Question
Fall 2012: Due 10/11/20121. Write a program in Java to calculate the volume of a cone, cylinder, and a cube. The
program should have three classes one for each type of object. (10 points)
2. Use your creativity to modify the program developed for question 2 to implement
overloading. (20 points)
3. Modify the above program to implement overriding. Here the user needs to enter the
dimensions and the type of the object for which these dimensions belong. Depending on
the type of object in consideration the program should hand over the calculation to the
specific method embedded in an inherited class. (30 points)
4. Use Java Reflection API to identify the methods and classes included in the program
written for question 2. (40 points)
Note: The submission for homework 2 will include four .java files. The instructor will
require two separate programs for all the questions. All these files have to be saved in a
compressed folder with your name (the folder should have your firstname and lastname
as its name). This folder has to be uploaded using the dropbox option under week 6.
Explanation / Answer
#include // required for input/output. #include // required for atan() function. using namespace std; // required for console input/output. // User-input control function (avoids garbage input). unsigned int GetNum( char * prompt ) { int iResult = 0; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.