Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write the code and explanations in details. Thanks. Problem A: Spherical Coordinates (20 points) There are a variety of ways to specify a point

image text in transcribedimage text in transcribed

please write the code and explanations in details. Thanks.

Problem A: Spherical Coordinates (20 points) There are a variety of ways to specify a point in three dimensions. The most common one is by using Cartesian coordinates, that is, specifying a point by giving its x, y, z coordinates. However, there are other ways that are useful. For example, one way is by spherical coordinates. The spherical coordinates for a point with Cartesian coordinates (x, y, z) is a triple (r, ,d) with an 2 -coS Note that different fields have different conventions for spherical coordinates. For example, some fields interchange the and coordinates. For this assignment use the coordinate ordering and equations above. Your task is to construct a C++ program that allows a user to input the x,y, z coordinates of a point, and then computes and outputs the spherical coordinates. The output format should give the coordinates surrounded by parentheses, separated by commas and a space (as shown below), and with and given in degrees, not radians. Here is what an example run of the program should look like for a test case (1.0, 1.0, 0.5). Input values are shown by underlining. Your program should not print out underlines the underlines are there only to distinguish user input from what your program should print. Input Cartesian coordinates x, y, z: 1.0 1.0 0.5 Spherical coordinates: (1.5, 45, 70.5288) And here is a second example with different input values Input Cartesian coordinates x, y, z: -4.2 0.0 0.0 Spherical coordinates: (4.2, 180, 90) Additional instructions: 1. Test your program using not only the example input above, but also other test cases you make up. 2. For this program you do not need to check for problems like division by 0 errors. 3. Be particularly careful not only that your output values are correct, but also that your answer follows the format above. Avoid misspellings, extra spaces, or anything else that is not in accordance with the formatting

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

What are the role of supervisors ?

Answered: 1 week ago

Question

3. Describe the process of a union drive and election.

Answered: 1 week ago

Question

6. What actions might make employers lose elections?

Answered: 1 week ago