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
Coal fire burning at 1100 k delivers heat energy to a reservoir at 500 k. Find maximum efficiency.
Marizza181 [45]

Answer:

<em>55%</em>

Explanation:

hot reservoir = 1100 K

cold reservoir = 500 K

<em>This is a Carnot system</em>

For a Carnot system, maximum efficicency of the system is given as

Eff = 1 - \frac{Tc}{Th}

where Tc = temperature of cold reservoir = 500K

Th = temperature of hot reservoir = 1100 K

Eff = 1 - \frac{500}{1100}

Eff = 1 - 0.45 = 0.55 or<em> 55%</em>

7 0
3 years ago
Ughhh my cramps hurt sm
kozerog [31]

Answer:

Explanation:Come

tomate

5 0
2 years ago
Read 2 more answers
Five kilograms of air at 427°C and 600 kPa are contained in a piston–cylinder device. The air expands adiabatically until the pr
son4ous [18]

Answer:

The entropy change of the air is 0.240kJ/kgK

Explanation:

T_{1} =427+273K,T_{1} =700K\\P_{1} =600kPa\\P_{2} =100kPa

T_{2}  is unknown

we can apply the following expression to find T_{2}

-w_{out} =mc_{v} (T_{2} -T_{1} )

T_{2} =T_{1} -\frac{w_{out } }{mc_{v} }

now substitute

T_{2} =700K-\frac{600kJ}{5kg*0.718kJ/kgK} \\T_{2}=533K

To find entropy change of the air we can apply the ideal gas relationship

Δs_{air}=c_{p} ln\frac{T_{2} }{T_{1} } -Rln\frac{P_{2} }{P_{1} }

Δs_{air} =1.005*ln(\frac{533}{700})-0.287* in(\frac{100}{600} )

Δs_{air} =0.240kJ/kgK

4 0
3 years ago
State the number of terms for each of the following algebraic expression 2x+1
harina [27]

Answer:

Expressions are made up of terms.

A term is a product of factors.

Coefficient is the numerical factor in the term

Before moving to terms like monomials, binomials, and polynomials, like and unlike terms are discussed.

When terms have the same algebraic factors, they are like terms.

When terms have different algebraic factors, they are unlike terms.

Explanation:

Hi please follow me also if you can and thanks.

6 0
3 years ago
What is the Energy of moving things?<br><br> mechanical<br> sound<br> nuclear<br> Light
Elenna [48]

Answer: Kinetic energy

Explanation: If you live in a country other than UK you will probably call it something different

4 0
3 years ago
Read 2 more answers
Other questions:
  • A 300 mm long steel bar with a square cross section (25 mm per edge) is pulled in tension with a load of 83,051 N , and experien
    10·1 answer
  • A large prime number isP = 232582657 - 1
    8·1 answer
  • In terms of the atomic radius, R, determine the distance between the centers of adjacent atoms for the FCC crystal structure alo
    15·1 answer
  • A single lane highway has a horizontal curve. The curve has a super elevation of 4% and a design speed of 45 mph. The PC station
    8·1 answer
  • The line touching the circle at a point ....................... is known as ........................... .
    12·1 answer
  • The gage pressure measured as 2.2 atm, the absolute pressure of gas is 3.2 bar. Please determine the local atmospheric pressure
    14·1 answer
  • What is the purpose of the graphic language?
    15·1 answer
  • In a case where electrical current leakage from the circuit occurs, the GFCI would do the following:
    13·1 answer
  • What can be used to measure the alcohol content in gasoline? A. Graduated cylinder B. Electronic tester C. Scan tool D. Either a
    5·1 answer
  • Explain wet and dry compression tests​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!