Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ programming: The distance between 2 points (x1, y1) and (x2, y2) in the Cartesian plan is computed using: sqrt((x2 x1)^2 + (y2 y1)^2) 1.

C++ programming: The distance between 2 points (x1, y1) and (x2, y2) in the Cartesian plan is computed using: sqrt((x2 x1)^2 + (y2 y1)^2)

image text in transcribed

1. 20 points] The distance between 2 points (y and y) in the Cartesian plan is computed using: (a) Write a function getPoint that prompts a user to enter a data point and returns it. (b) Write a function distance that takes as its parameters four numbers that represent two points and returns the distance between them CPSC 1620 Assignment 6 (c) Write a function radius that takes as its parameters four numbers that represent the center and a point on the circle, calls the function distance to find the radius of the circle, and returns the circle's radius. (d) Write a function circumference that takes as its parameters a number that rep- (e) Write a function area that takes as its parameters a number that represents the (f) Write a program that repeatedly prompts the user to enter the center and a point on resents the radius of the circle and returns the circle's circumference. radius of the circle and returns the circle's area. the circle. The program should then output the circle's radius, diameter, circumfer- ence, and area. For example, Enter a data point x and y -- 0 0 Enter a data point x and y -- 4 3 The circle's radius is-5 The circle's diameter is10 The circle's circumference is 31.415 The circle' area is78.537S Try again {Y/N) -- Y Enter a data point x and y-2-1 Enter a data point x and y 3.4 7.5 The cirele' s radius is-8.61452 The circle's diameter is 17.229 The circle's circumference is 54.125 The circle's area is233.131 Try again Y/NN 1. 20 points] The distance between 2 points (y and y) in the Cartesian plan is computed using: (a) Write a function getPoint that prompts a user to enter a data point and returns it. (b) Write a function distance that takes as its parameters four numbers that represent two points and returns the distance between them CPSC 1620 Assignment 6 (c) Write a function radius that takes as its parameters four numbers that represent the center and a point on the circle, calls the function distance to find the radius of the circle, and returns the circle's radius. (d) Write a function circumference that takes as its parameters a number that rep- (e) Write a function area that takes as its parameters a number that represents the (f) Write a program that repeatedly prompts the user to enter the center and a point on resents the radius of the circle and returns the circle's circumference. radius of the circle and returns the circle's area. the circle. The program should then output the circle's radius, diameter, circumfer- ence, and area. For example, Enter a data point x and y -- 0 0 Enter a data point x and y -- 4 3 The circle's radius is-5 The circle's diameter is10 The circle's circumference is 31.415 The circle' area is78.537S Try again {Y/N) -- Y Enter a data point x and y-2-1 Enter a data point x and y 3.4 7.5 The cirele' s radius is-8.61452 The circle's diameter is 17.229 The circle's circumference is 54.125 The circle's area is233.131 Try again Y/NN

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

Students also viewed these Databases questions