//*********************************************************** // File: garden.cpp // Author: // Create Date: // Last Modified: // Class: CPSC 220, section // Language: C++ // Purpose: To compare the cost of flower bed materials // Input: (from standard input) the diameters of 3 circles // and the prices of the two materials // Output: (to standard output) a cost comparison report // Pledged: // //*********************************************************** #include int main ( void ) { // Function prototypes float ComputeCircumference ( float ); float ComputeArea ( float ); // Local variable declarations float diameter1; // diameter of circle1 float diameter2; // diameter of circle2 float diameter3; // diameter of circle3 float price1; // price of border material1 float price2; // price of border material2 float circ1; // circumference of circle1 float circ2; // circumference of circle2 float circ3; // circumference of circle3 float area1; // area of circle1 float area2; // area of circle2 float area3; // area of circle3 // input measurements of three plots cin >> diameter1; cin >> diameter2; cin >> diameter3; // input each unit price of the two border materials // INSERT THE CODE TO INPUT THE PRICES OF THE TWO BORDER // MATERIALS HERE // display table headers cout << endl << endl; cout.setf(ios::left, ios::adjustfield); cout << setw(8) << "Circle"; cout.setf(ios::right, ios::adjustfield); cout << setw(13) << "Circum (ft)"; cout << setw(20) << "Cost of Material 1"; cout << setw(20) << "Cost of Material 2"; cout << setw(10) << "Area" << endl << endl; // compute circumferences // INSERT THE FUNCTION CALLS TO COMPUTE THE CIRCUMFERENCES OF THE // CIRCLES HERE // compute areas // INSERT THE FUNCTION CALLS TO COMPUTE THE AREA OF THE CIRCLES HERE // set up floating point output // INSERT CODE TO INITIALIZE FLOATING POINT OUTPUT HERE // output first circle info // INSERT CODE TO OUTPUT THE FIRST CIRCLE INFORMATION HERE // output second circle info // INSERT CODE TO OUTPUT THE SECOND CIRCLE INFORMATION HERE // output third circle info // INSERT CODE TO OUTPUT THE THIRD CIRCLE INFORMATION HERE return 0; } // end main /*********************************************************/ /* Function: float ComputeCircumference (float diameterOfCircle) */ /* Purpose: To Calculate the circumference of the circle*/ /* Input Parameters: the diameter of the circle */ /* Postcondition: returns the circumference of the circle*/ /*********************************************************/ float ComputeCircumference ( float diameterOfCircle ) //diameter { float circumferenceOfCircle ; circumferenceOfCircle = M_PI * diameterOfCircle ; return ( circumferenceOfCircle ); }//end function ComputeCircumference /*********************************************************/ /* Function float ComputeArea (float diameterOfCircle) */ /* Purpose: To Calculate the area of the circle */ /* Input Parameters: the diameter of the circle */ /* Postcondition: returns the area of the circle */ /*********************************************************/ float ComputeArea ( float diameterOfCircle ) //diameter { float areaOfCircle ; // PLACE CODE HERE TO COMPUTE THE AREA return ( areaOfCircle ); }//end function ComputeArea