drandbone92
25.07.2019 •
Computers and Technology
Create an application program that will compute theradius and circumference of a circle. write a main class methods to prompt for and input the radius of acircle(getradius), calculate thecircumference(calccirc), and calculate thearea(calcarea) of a circle. define the radius,area, and circumference in main which will call each calc method,passing radius to each one. assume pi = 3.14159 or use themath.pi builtin constant. format theoutput to show two decimal places in the calculatedvalues.
Solved
Show answers
More tips
- A Animals and plants How to Grow Lime from a Seed: Simple Tips and Interesting Facts...
- C Computers and Internet How to Create a Folder on Your iPhone?...
- G Goods and services How to sew a ribbon: Tips for beginners...
- F Food and Cooking How to Make Mayonnaise at Home? Secrets of Homemade Mayonnaise...
- C Computers and Internet Which Phone is Best for Internet Surfing?...
- F Food and Cooking Everything You Need to Know About Pasta...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
- S Style and Beauty How to Make Your Lips Fuller? Ideas and Tips for Beautiful Lips...
Answers on questions: Computers and Technology
- C Computers and Technology Maya and Darius are using the software development life cycle to develop a career interest app. They wrote the program pseudocode and have a mock-up of how the software...
- C Computers and Technology 1010 1111 0011 is an even parity 12 bit hamming code that contains a single-bit error. what is the corresponding uncorrupted hamming code...
- C Computers and Technology Which is the best method of marketing a game to casual players?...
- C Computers and Technology write code that removes the first and last elements from a list stored in a variable named my_list. assume that the list has been initialized and contains at least two...
- C Computers and Technology Which protocol is used to handle delivery of information from one network to another?...
- C Computers and Technology Only cool people answer this question. are you cool?...
- E English What is Nolka’s response when she first meets the Chenoo? She screams for her brothers’ help. She threatens the Chenoo and demands that he leave. She looks for an escape...
- H History Which of the following describes a difference between france just after the French Revolution and after Napoleon. A. Just after the revolution, France was divided into...
- M Mathematics a tree needs to be staked with four wires, each wire is attached to the trunk 6 feet above the ground, and then anchored to the ground 8 feet from the base of the tree....
- B Biology What might account for the unusual results you obtained in the experiment in Part C? Select the two correct answers. Select the two correct answers. The unusual F1 female...
Ответ:
The c++ program is given below.
#include <iostream>
#include<iomanip>
using namespace std;
double getRadius();
double calcCirc(double r);
double calcArea(double r);
int main() {
double radius, area, circumference;
int r, c, a;
radius = getRadius();
if(radius>0 && radius<10)
r=3;
if(radius>10 && radius<100)
r=4;
if(radius>100 && radius<1000)
r=5;
cout<<"The radius of the circle is "<<setprecision(r)<<radius<<endl;
circumference=calcCirc(radius);
if(circumference>0 && circumference<10)
c=3;
if(circumference>10 && circumference<100)
c=4;
if(circumference>100 && circumference<1000)
c=5;
cout<<"The circumference of the circle is "<<setprecision(c)<<circumference<<endl;
area=calcArea(radius);
if(area>0 && area<10)
a=3;
if(area>10 && area<100)
a=4;
if(area>100 && area<1000)
a=5;
cout<<"The area of the circle is "<<setprecision(a)<<area<<endl;
}
double getRadius()
{
double r;
cout<<"Enter the radius of the circle : "<<endl;
cin>>r;
return r;
}
double calcCirc(double r)
{
double PI = 3.14159;
return (2*PI*r);
}
double calcArea(double r)
{
double PI = 3.14159;
return (PI*r*r);
}
OUTPUT
Enter the radius of the circle :
11.1111
The radius of the circle is 11.11
The circumference of the circle is 69.81
The area of the circle is 387.85
Explanation:
As per the requirement, all the variables radius, area, and circumference are declared with data type double in main function.
The methods getRadius, calcCirc, calcArea are declared with return type double.
getRadius
This method prompts the user to input the radius and returns the radius to the calling function main. This value is stored in variable radius.
calcCirc
This method takes radius as input, calculates the circumference and returns the circumference to the calling function main. This value is stored in variable circumference.
calcArea
This method takes radius as input, calculates the area and returns the area to the calling function main. This value is stored in variable area.
All the three values are displayed with two decimal places. This is achieved using setprecision() method.
The number of digits is inclusive of 2 decimal places and all digits before the decimal. This value is declared based on the values of radius, circumference and area. The total number of digits is passed as a parameter to the setprecision() method.
All the values are displayed with two decimal places.
Ответ:
hii
Explanation:
I hope you are best for suggesting