Question
/* * Name: * Class: CS140-001 * Assignment: Programming Assignment 2 * Date: 01/26/2018 */ #include using namespace std; const double PI = 3.14159; int
/*
* Name:
* Class: CS140-001
* Assignment: Programming Assignment 2
* Date: 01/26/2018
*/
#include
using namespace std;
const double PI = 3.14159;
int main()
{
double x;
double y;
double radius;
double center;
double area;
double circumference;
cout.setf(ios::fixed);
cout.precision(2);
cout << "Programmed by Taylor Heimann" << endl << endl;
cout << "Enter the x and y coordinates of the center of the circle: ";
cin >> x;
cout << " ";
cin >> y;
cout << "Enter the radius of the circle: ";
cin >> radius;
cout << "****************************" << endl;
cout << "Circle Information" << endl;
cout << "Radius: " << radius << endl;
cout << "Center: (" << x << ", " << y << ")" << endl;
area = PI * radius * radius;
circumference = 2 * PI * radius;
cout << "Area: " << area << endl;
cout << "Circumference: " << circumference << endl;
if (!(x == 0) && !(y == 0))
{
cout << "Circle is completely in Quadrant ";
if (x > 0)
{
if (y > 0) cout << "I";
else cout << "IV";
}
else if (x < 0)
{
if (y > 0) cout << "II";
else cout << "III";
}
}
if ((x == 0) && (y == 0))
{
cout << "Circle center is at the orgin";
}
if ((x == 0) && !(y = 0))
{
cout << "Circle center is on ";
{
if (x == 0) cout << "y";
else cout << "";
}
cout << " - axis";
}
if (!(x == 0) && (y == 0))
{
cout << "Circle center is on ";
{
if (y == 0) cout << "x";
else cout << "";
}
cout << " - axis";
}
if ((x != 0) && (y != 0))
{
cout << "Circle crosses at least one of the axes and the center is not on an axis";
}
cout << endl;
cout << "****************************" << endl;
system("pause");
}
OUTPUTS
Programmed by Lori Tetzner
Enter the x and y coordinates of the center of the circle: 6.5 -3.7
Enter the radius of the circle: 4.2
****************************
Circle Information Radius: 4.2
Center: (6.5, -3.7)
Area: 55.42 Circumference: 26.39
Circle crosses at least one of the axes and the center is not on an axis
****************************
Programmed by Lori Tetzner
Enter the x and y coordinates of the center of the circle: -5.1 0
Enter the radius of the circle: 10
****************************
Circle Information Radius: 10
Center: (-5.1, 0)
Area: 314.16
Circumference: 62.83
Circle center is on x - axis
****************************
I am trying to write a program that looks EXACTLY like these out puts using "if else" statements.
I am having troble with the decimal places on some numbers.
also cant figure out the if else statement for the last line, first output..
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started