Using the fourstep development method write a function doubl

Using the four-step development method, write a function \"double area (double, double&)\" that calculates the area, a, of a circle when its circumference, c, is given and it additionally returns the calculated value of radius, r. The relevant formulas are r = c/(2 pi) and a = pi r^2, where pi = 2 sin^-1 1. You may use \"asin\" and \"pow\" functions from the library. Write a C++ program that accepts the value of the circumference from the user, calculates the radius and area, and displays the calculated values. Your program must instantiate the function \"double area (double, double&) \". (Input data validation and/or additional test cases will lead to BONUS CREDITS). Analyze the Problem - From the specified function prototype double area (double, double&), we find one double input () and two double outputs (). Develop a Solution - Input Data Validation (Bonus Credit 2): Hand Calculations, Test Cases:

Solution

#include <iostream>

#include <cmath>

using namespace std;

const double PI = 3.14;

    void compute();

        void Getvalue(double&);

        double computeCircumference(double);

        double computeArea(double, double& );

// ===============

    int main() {

               double c;

               double radius = 0;

               double area = 0;

               double a;

               Compute();

              

               Getvalue(radius);

       

               c = computeCircumference(radius);

               a = computeArea(radius,area);

       cout << c << endl;

           cout << a << endl;

            return 0;

    } // Function Main

        void Compute() {

              

               cout << \"Please Enter a value for the radius of a circle.\" << endl;

               cout << \"I will tell the circumference and area of it. \"   << endl;

              

        } // Function Compute

        void Getvalue(double& radius2) {

       

        cout << \"Please enter your radius of a circle: \";

        cin >> radius2;

       

        } // Funciton Getvalue

// ======================

// ====================

    double computeCircumference( double radius1) {

               double c;

               c = 2*PI*radius1;

               return c;

        }// Function computecircumference

// =================================

// ================

        void computeArea(double radius2, double& a) {

              

               a = PI*pow(radius2,2);

              

              

        }

#include <iostream>

#include <cmath>

using namespace std;

const double PI = 3.14;

    void compute();

        void Getvalue(double&);

        double computeCircumference(double);

        double computeArea(double, double& );

// ===============

    int main() {

               double c;

               double radius = 0;

               double area = 0;

               double a;

               Compute();

              

               Getvalue(radius);

       

               c = computeCircumference(radius);

               a = computeArea(radius,area);

       cout << c << endl;

           cout << a << endl;

            return 0;

    } // Function Main

        void Compute() {

              

               cout << \"Please Enter a value for the radius of a circle.\" << endl;

               cout << \"I will tell the circumference and area of it. \"   << endl;

              

        } // Function Compute

        void Getvalue(double& radius2) {

       

        cout << \"Please enter your radius of a circle: \";

        cin >> radius2;

       

        } // Funciton Getvalue

// ======================

// ====================

    double computeCircumference( double radius1) {

               double c;

               c = 2*PI*radius1;

               return c;

        }// Function computecircumference

// =================================

// ================

        void computeArea(double radius2, double& a) {

              

               a = PI*pow(radius2,2);

              

              

        }

 Using the four-step development method, write a function \
 Using the four-step development method, write a function \
 Using the four-step development method, write a function \
 Using the four-step development method, write a function \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site