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
Rosita is planning an investigation to determine how a lifeboat's shape affects its
KiRa [710]
Yes! Is right, just did the work!
3 0
3 years ago
What kind of car is this
juin [17]

Answer:

camaro

Explanation:

5 0
3 years ago
Read 2 more answers
Show the ERD with relational notation with crowfoot. Your ERD must show PK, FKs, min and max cardinality, and correct line types
zhenek [66]

Answer

The answer and procedures of the exercise are attached in the following archives.

Step-by-step explanation:

You will find the procedures, formulas or necessary explanations in the archive attached below. If you have any question ask and I will aclare your doubts kindly.  

3 0
3 years ago
3.Which of the following drawings are matched with the project specifications to form the bulk of the contract document?
Ivan
Can you show us the drawings
4 0
2 years ago
A cylindrical bar of metal having a diameter of 17.8 mm and a length of 196 mm is deformed elastically in tension with a force o
ExtremeBDS [4]

Answer:

A) ΔL = 0.544 mm

B) Δd = -0.0168 mm

Explanation:

We are given;

Elastic modulus; E = 67.1 GPa = 67.1 × 10^(9) Pa

Force; F = 46400 N

Diameter; d = 17.8 mm = 17.8 × 10^(-3) m

Radius; r = d/2 = 17.8/2 = 8.9 mm = 8.9 × 10^(-3) m

Length; L = 196 mm = 0.196 m

Poisson ratio; ν = 0.34

A) We know that formula for elastic modulus is;

E = σ/ε

Where;

σ = F/A

ε = ΔL/L

Thus;

E = (FL/ΔL•A)

ΔL is change in length. Making it the subject of the formula, we have;

ΔL = FL/AE

Now, A = πr²

A = π × (8.9 × 10^(-3))²

ΔL = [(0.196 × 46400)/(π × (8.9 × 10^(-3))² × 67.1 × 10^(9)]

ΔL = 0.544 × 10^(-3) m

ΔL = 0.544 mm

B) formula for Poisson ratio is given as;

ν = -ε_x/ε_z

Where;

ε_x is transverse strain = Δd/d

ε_z is longitudinal strain = ΔL/L

Thus;

ν = -Δd•L/d•ΔL

Making Δd the subject, we have;

Δd = -νdΔL/L

Δd = -(0.34 × 17.8 × 10^(-3) × 0.544 × 10^(-3))/0.196

Δd = -0.0168 × 10^(-3) m = -0.0168 mm

7 0
3 years ago
Other questions:
  • The density of a certain material is such that it weighs 9 pounds per cubic foot of
    10·1 answer
  • An insulated tank having a total volume of 0.6 m3 is divided into two compartments. Initially one compartment contains 0.4 m3 of
    8·1 answer
  • Is normally a large red cable connected to the battery
    11·2 answers
  • B. Is the “Loading Time” of any online application a functional or a non-functional requirement? Can the requirement engineers s
    11·1 answer
  • Employees cannot be held legally responsible for an environmental violation.
    14·1 answer
  • Recommend the types of engineers needed to collaborate on a city project to build a skateboard park near protected wetlands.
    6·1 answer
  • Prelest! Introduction to Engineering and Technology 1 Select the correct answer. What technological invention allowed for the pr
    5·1 answer
  • Which statement about cathode ray tubes (CRTs) is true?
    13·1 answer
  • 17
    14·1 answer
  • the maximum load that a hori-zontal beam can carry is directly proportional to its width. if a beam 1.5 inches wide can support
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!