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]
4 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]4 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
For a copper-silver alloy of composition 25 wt% Ag-75 wt% Cu and at 775C (1425F) do the following: (a) Determine the mass frac
allochka39001 [22]

Answer:

a)

mass fraction of α = 0.796

mass fraction of β = 0.204

b)

mass fraction of primary α (Wα) = 0.734

mass fraction of  eutectic micro-constituents (We) = 0.266

c)

α in eutectic mixture = 0.062

Explanation:

Assumptions:

(i) the  system is in thermal equilibrium with its surroundings

(ii) There are no impurities or other alloying elements present

(a) Determine the mass fractions of α and β phases

From the Cu - Ag phase diagram, Cα = 8.0 wt% Ag, Cβ = 91.2 wt% Ag, and C0 = 25 wt% Ag .Using the lever-rule:

Total mass fraction of α = (Cβ - C0) / (Cβ - Cα) = (91.2 - 25) / (91.2 - 8) = 0.796

Total mass fraction of β = (C0 - Cα) / (Cβ - Cα) = (25 - 8) / (91.2 - 8) = 0.204

(b) Determine the mass fractions of primary α and eutectic microconstituents

Ceutetic = 71.9 wt.%Ag

mass fraction of primary α (Wα) = (Ceutetic - C0) / (Ceutetic - Cα) = (71.9 - 25) / (71.9 - 8) = 0.734

mass fraction of  eutectic micro-constituents (We) = (C0 - Cα) / (Ceutetic - Cα) = (25 - 8) / (71.9 - 8) = 0.266

(c) Determine the mass fraction of eutectic α.

From the eutetic reaction, L  ↔    α + β

Total α = Primary α + α in eutectic mixture

Therefore: α in eutectic mixture = Total α - Primary α = 0.796 - 0.734 = 0.062

5 0
3 years ago
Read 2 more answers
2–25 Consider a medium in which the heat conduction equation is given in its simplest form as
barxatty [35]

Answer:

d) Is the thermal conductivity of the medium constant or variable.

Explanation:

As we know that

Heat equation with heat generation at unsteady state and with constant thermal conductivity given as

\dfrac{d^2T}{dx^2}+\dfrac{d^2T}{dy^2}+\dfrac{d^2T}{dz^2}+\dfrac{\dot{q}_g}{K}=\dfrac{1}{\alpha }\dfrac{dT}{dt}

With out heat generation

\dfrac{d^2T}{dx^2}+\dfrac{d^2T}{dy^2}+\dfrac{d^2T}{dz^2}=\dfrac{1}{\alpha }\dfrac{dT}{dt}

In 2 -D with out heat generation with constant thermal conductivity

\dfrac{d^2T}{dx^2}+\dfrac{d^2T}{dy^2}=\dfrac{1}{\alpha }\dfrac{dT}{dt}

Given equation

\dfrac{d^2T}{dx^2}+\dfrac{d^2T}{dy^2}=\dfrac{1}{a }\dfrac{dT}{dt}

So we can say that this is the case of  with out heat generation ,unsteady state and with constant thermal conductivity.

So the option d is correct.

d) Is the thermal conductivity of the medium constant or variable.

3 0
3 years ago
What was the Strategic Air Command?
Lemur [1.5K]

I'm not sure UBS hand UBS d es. used ins d UBS d jbs is. DHS. u s dibs us dibs de DJ d DJ is end dijjee job DJ dje had d USB e ujjde in dr. hvdn. jdjhe

6 0
3 years ago
Read 2 more answers
What was the role of the rotors in the enigma machine?.
Lisa [10]

Answer:

Implements a reordering of the letters of the alphabet.

Explanation: GIVE ME 5 STARS AND a HEART!!!                                      Those contacts are wired across the rotor so that each contact on the left connects to the contact on the right in some scrambled arrangement. Each rotor, therefore, implements a reordering of the letters of the alphabet, which mathematicians call a permutation.

3 0
3 years ago
Onbalance, the authors seem to _____________ (like or dislike) Roosevelt and his program. On p. 804, they say thatFDR was like _
ehidna [41]

Answer:

like; Hamilton; Jefferson.

Explanation:

In the given excerpt, there was a national depth expansion that was as a result of the war that occurred between 1939 and 1945. The war led to the destruction of basic amenities and infrastructures as well as buildings. This ultimately created national depth. It also cost a significant amount to rebuild from scratch.

5 0
3 years ago
Other questions:
  • An inclined rectangular sluice gate AB 1.2 m by 5 m size as shown in Fig. Q3 is installed to control the discharge of water. The
    6·1 answer
  • Explain the conductivity results observed for ionic compounds in the solid state and in aqueous solution.i.Solid ionic compounds
    12·1 answer
  • The in situ moist unit weight of a soil is 17.3 kN/m3 and the moisture content is 16%. The specific gravity of soil solids is 2.
    12·1 answer
  • Two gage marks are placed exactly 250 mm apart on a 12-mm-diameter aluminum rod with E 5 73 GPa and an ultimate strength of 140
    8·1 answer
  • George and Ellen Rottweiler encourage their adult daughter Guinevere to break her engagement and continue living in their home,
    13·1 answer
  • A 1998 Lexus LS400 has a drag coefficient of 0.28 and a reference area of 2.4 m2. Determine the horsepower required to overcome
    8·1 answer
  • When discussing universal joints,
    15·1 answer
  • How to draw the output voltage waveform rectifier
    8·1 answer
  • A 10 kg mass is lifted to a height of 2 m What is the potiental energy at this position
    13·1 answer
  • If it is safe to do so you should shut off your engine if it’s going to be idling for longer than?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!