1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mina [271]
3 years ago
11

Write a modular program that finds the equation, area, and circumference of a circle, given the coordinates of the center of the

circle and coordinates of a point on the circle which are entered by the user. Given the coordinates of the center of a circle (Cx, Cy) and the coordinates of a point on the circle (Px, Py) we can find the radius of the circle using the following formula: r= J(Cx - Px)2 + (Cy – Py)? The equation of the circle with radius r and center (Cx, Cy) is: (x – Cx)2 + (y – Cy)2 = y2 Calculate the value of a constant PI (TT) as follows: n = acos(-1) Your program must utilize at least four meaningful called functions that you define. One of the functions will get the coordinates of the center of the circle and the coordinates of a point on the circle and place them in variables defined in main by reference. Also you must use functions to calculate and return the area and circumference of a circle. These functions must be prototyped as follows (you may include the parameter name, but the argument and return type must not be changed): double findArea (double); double findCircum (double); Please note, the final versions of findArea and findCircum do NOT print anything. Don't forget that the definitions of functions (not the prototypes, the definitions) must be preceded by a comment that describes what the function does, the arguments or other inputs it gets (from the user) and the value it returns (if any) or other outputs it produces (displays on the screen). Sample output of a program that satisfies the requirements is shown below. Try to make your output look as much like this as possible. The default precision was used in the sample. The data entered by the user is in blue. Sample Output 1: Enter the x and y coordinates of the center of the circle separated by a comma: 2,5 Enter the x and y coordinates of a point on the circle separated by a comma: 6,2 A circle centered at (2, 5) passing through a point (6, 2) has the equation: (x - 2)^2 + (y – 5)^2 = 25 The circle has an area of 78.5398 square units. The circle has a circumference of 31.4159 units.
Engineering
1 answer:
Semenov [28]3 years ago
3 0

Answer:

Explanation:

#include <bits/stdc++.h>

#include <iostream>

#include <string>

#include <cmath>

using namespace std;

//this function reads the cooridnates of Center from the user

//parameteres are pointer variables of Cx,Cy

//it does not return anything and stores coordinates at given addresses of Cx,Cy

void readCenter(int *Cx,int *Cy)

{

string cooridnates;

cout << "Enter the x and y cooridnates of the centre of the circle separated by comma: " ;

getline(cin,cooridnates);//reading inputs

//convering string ot integer

string x = cooridnates.substr(0, cooridnates.find(","));

string y = cooridnates.substr(cooridnates.find(",")+1);

*Cx=stoi(x);

*Cy=stoi(y);

}

//this function reads the cooridnates of Point from the user

//parameteres are pointer variables of Px,Py

//it does not return anything and stores coordinates at given addresses of Px,Py

void readPoint(int *Px,int *Py)

{

string cooridnates;

cout << "Enter the x and y cooridnates of a point on the circle separated by comma: " ;

getline(cin,cooridnates);//reading inputs

//convering string ot integer

string x = cooridnates.substr(0, cooridnates.find(","));

string y = cooridnates.substr(cooridnates.find(",")+1);

*Px=stoi(x);

*Py=stoi(y);

}

double findArea(double radius)

{

double pi=acos(-1);

return pi*pow(radius,2);

}

double findCircum(double radius)

{

double pi=acos(-1);

return 2*pi*radius;

}

int main()

{

int Cx,Cy;

int Px,Py;

readCenter(&Px,&Py);

readPoint(&Cx,&Cy);

double radius=sqrt(pow((Px-Cx),2)+pow((Py-Cy),2));

cout<<"The circle has an area of "<<findArea(radius)<<" sqaure units\n";

cout<<"The circle has a Circumference of "<<findCircum(radius)<<" units";

return 0;

}

You might be interested in
If you touch a downed power line, covered or bare, what's the likely outcome?
olya-2409 [2.1K]

Answer:

you get electrocuted...........

5 0
3 years ago
Read 2 more answers
Engineers are problem blank<br> who use critical thinking to create new solutions.
Nana76 [90]

Answer:

problem solvers

Explanation:

7 0
2 years ago
Read 2 more answers
A bakery wants to determine how many trays of doughnuts it should prepare each day. Demand is normal with a mean of 15 trays and
shutvik [7]

The number of trays that should be prepared if the owner wants a service level of at least 95% is; 7 trays

<h3>How to utilize z-score statistics?</h3>

We are given;

Mean; μ = 15

Standard Deviation; σ = 5

We are told that the distribution of demand score is a bell shaped distribution that is a normal distribution.

Formula for z-score is;

z = (x' - μ)/σ

We want to find the value of x such that the probability is 0.95;

P(X > x) = P(z > (x - 15)/5) = 0.95

⇒ 1 -  P(z ≤ (x - 15)/5) = 0.95

Thus;

P(z ≤ (x - 15)/5) = 1 - 0.95

P(z ≤ (x - 15)/5) = 0.05

The value of z from the z-table of 0.05 is -1.645

Thus;

(x - 15)/5 = -1.645

x ≈ 7

Complete Question is;

A bakery wants to determine how many trays of doughnuts it should prepare each day. Demand is normal with a mean of 15 trays and standard deviation of 5 trays. If the owner wants a service level of at least 95%, how many trays should he prepare (rounded to the nearest whole tray)? Assume doughnuts have no salvage value after the day is complete. 6 5 4 7 unable to determine with the above information.

Read more about Z-score at; brainly.com/question/25638875

#SPJ1

4 0
1 year ago
A motorist enters a freeway at 25 mi/h and accelerates uniformly to 65 mi/h. From the odometer in the car, the motorist knows th
Helga [31]

Answer:

a) 2.2 m/s² b) 8 s

Explanation:

a) Assuming that the acceleration is constant, we can use any of the kinematic equations to solve the question.

As we don´t know the time needed to accelerate, we can use the following equation:

vf2 – vo2 = 2*a*∆x

At first, we can convert the values of vf, vo and ∆x, to SI units, as follows:

vf = 65 mi/h* (1,605 m / 1mi) * (1h/3,600 sec) = 29 m/s

vo = 25 mi/h *(1,605 m / 1mi) * (1h/3,600 sec) = 11.2 m/s

∆x = 0.1 mi*(1,605 m / 1mi) = 160.5 m

Replacing these values in (1), and solving for a, we have:

a = (29 m/s – 11.2 m/s) / 321 m = 2.2 m/s2

b) In order to obtain the time needed to reach to 65 mi/h, we can rearrange the equation for the definition of acceleration, as follows:

vf = vo + at  

Replacing by the values already known for vo, vf and a, and solving for t, we get:

t = vf-vo /a = (29 m/s – 11.2 m/s) / 2.2 m/s = 8 sec

5 0
2 years ago
The mass flow rate in a 4.0-m wide, 2.0-m deep channel is 4000 kg/s of water. If the velocity distribution in the channel is lin
IceJOKER [234]

Answer:

V = 0.5 m/s

Explanation:

given data:

width of channel =  4 m

depth of channel = 2 m

mass flow rate = 4000 kg/s = 4 m3/s

we know that mass flow rate is given as

\dot{m}=\rho AV

Putting all the value to get the velocity of the flow

\frac{\dot{m}}{\rho A} = V

V = \frac{4000}{1000*4*2}

V = 0.5 m/s

4 0
3 years ago
Other questions:
  • Air is compressed in the compressor of a turbojet engine. Air enters the compressor at 270 K and 58 kPa and exits the compressor
    13·1 answer
  • A driver on a leveltwo-lane highway observes a
    6·1 answer
  • How are scientific discoveries used in engineering design?
    12·1 answer
  • Cold water at 20 degrees C and 5000 kg/hr is to be heated by hot water supplied at 80 degrees C and 10,000 kg/hr. You select fro
    14·1 answer
  • Products. of sheet metal​
    8·1 answer
  • Yooo. does anyone have tin foil and tape mask that they can take a picture of and send it ?
    5·1 answer
  • Since no one is perfect is that a sentence fragment
    10·2 answers
  • Concrete ___ support and anchor the bottom of steel columns and wood post, which support beams that are pare of framing system o
    11·1 answer
  • Can you help me with this task/homework.
    11·1 answer
  • 8. What are used by the project architect to depict different building systems and to show how they correlate to one anothe
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!