473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

program to find the dimensions of a circle

Given the center and a point on the circle, you can use this formula to find the radius of the circle. Write a program that prompts the user to enter the center and a point on the circle. The program should then output the circle’s radius, diameter, circumference, and area. Your program must have at least the following functions: a. distance: This function takes as its parameters four numbers that represent two points in the plane and returns the distance between them. b. Radius : This function takes as its parameters four number 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. c. Circumference : This function takes as its parameter a number that represents the radius of the circle and returns the circle’s circumference. (if r is the radius, the circumference is 2 π r) d. Area: This function takes as its parameter a number that represents the radius of the circle and returns the circle’s area. ( if r is the radius, the area is π r2 ) Assume that π = 3.1416
May 18 '07 #1
9 5498
Ganon11
3,652 Expert 2GB
Interesting problem. Were you having trouble with this? Did you have a program that you were getting errors on? Trouble understanding the problem? We can't help you if you won't help yourself.
May 18 '07 #2
Silent1Mezzo
208 100+
Sounds like a program I did in my first programmer coures :P It's really not hard. There's algorithms on the net
May 18 '07 #3
i dont now any thing
May 18 '07 #4
Silent1Mezzo
208 100+
WEll think about this for a moment..Now...I'm assuming when you say the user enters the center and another point that this second point is on the edge of the circle (It has to be unless you're given a ratio of where it's located (e.g. the point is 2/3 away from the center)).

Anyways...Given the center and a point on the edge it's really easy to calculate the radius and diameter....Just calculate the length of the line...
May 18 '07 #5
AdrianH
1,251 Expert 1GB
i dont now any thing
I'm sorry? I think you know a lot more than you realise. You've got your problem, now tell me what steps you need to do to solve it.

Don't post code at this point. Assume that the computer is a person that will follow instructions. You talk to the person as input, the person does something and then talks back for output.

Now, what you need to think about is:
  • what are you going to say to the person?
  • what is the person going to have to do (i.e. what calculations will it need to do)?
  • what is the person going to say to you?

Frame your solution like:

person says, "What is the mass in grams?"
you say, "<some number>"
person stores m=<some number>
person calculates E=m*(c^2) where ^ means to the power of
person says "The energy in " m " grams is " E " Joules"


Adrian
May 18 '07 #6
Motoma
3,237 Expert 2GB
i dont now any thing
LOL. In that case, you need more help than this forum will be able to provide.
May 18 '07 #7
MMcCarthy
14,534 Expert Mod 8TB
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you.


Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.

ADMIN
May 19 '07 #8
Given the center and a point on the circle, you can use this formula to find the radius of the circle. Write a program that prompts the user to enter the center and a point on the circle. The program should then output the circle’s radius, diameter, circumference, and area. Your program must have at least the following functions: a. distance: This function takes as its parameters four numbers that represent two points in the plane and returns the distance between them. b. Radius : This function takes as its parameters four number 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. c. Circumference : This function takes as its parameter a number that represents the radius of the circle and returns the circle’s circumference. (if r is the radius, the circumference is 2 π r) d. Area: This function takes as its parameter a number that represents the radius of the circle and returns the circle’s area. ( if r is the radius, the area is π r2 ) Assume that π = 3.1416

OK, Let's get serious here....

Let us call your two points A and B. Your four numbers are then Ax, Ay, Bx, By. The length, L, of the line between these points is:
' Visual Basic
L = sqr( (Ax - Bx) ^ 2 + (Ay - By) ^ 2 )
/* C and C++ */
L = sqrt( pow( Ax - Bx, 2 ) + pow( Ay - By, 2 ) )
Since one of these points is the center of the circle and the other is on the circumference, this line is a radius of the circle. Therefore:
radius = L
diameter = 2 * L
circumference = 2 * pi * L
area = pi * ( L ^ 2 )
See how easy this is?? Have fun with it.....
May 19 '07 #9
AdrianH
1,251 Expert 1GB
OK, Let's get serious here....

Let us call your two points A and B. Your four numbers are then Ax, Ay, Bx, By. The length, L, of the line between these points is:
' Visual Basic
L = sqr( (Ax - Bx) ^ 2 + (Ay - By) ^ 2 )
/* C and C++ */
L = sqrt( pow( Ax - Bx, 2 ) + pow( Ay - By, 2 ) )
Since one of these points is the center of the circle and the other is on the circumference, this line is a radius of the circle. Therefore:
radius = L
diameter = 2 * L
circumference = 2 * pi * L
area = pi * ( L ^ 2 )
See how easy this is?? Have fun with it.....
Well saraaana, looks like JalapenoBob has given you part of the solution. Can you supply the rest?


Adrian
May 19 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any...
17
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I find the size of a browser window?...
1
by: coolindienc | last post by:
I converted this program from using global variables to local variables. When I did that my while loop stopped working in my main function(module). Anyone, any idea why? I underlined the area where...
1
by: coolindienc | last post by:
I converted this program from using global variables to local variables. When I did that my while loop stopped working in my main function(module). Anyone, any idea why? I underlined the area where...
4
by: saggie | last post by:
I cannot write this C program that uses a function to calculate the area of a circle, witha circle's circumference. This function (findArea) should call a second function (findRadius) which will...
7
by: Greatness | last post by:
Ceramic Floor Tile You’re working for a company that lays ceramic floor tile, and they need a program that estimates the number of boxes of tile for a job. A job is estimated by taking the...
4
by: Villanmac | last post by:
Ahhhh, ive missed so many lessons this year that i have to try and teach myself c++ from a book and its so hard. Usually I just read this forums to pick things up but its doing my head in trying to...
26
by: Prime Mover | last post by:
Hello all, I have got the pseudo-code below that I would like to convert to c language. The algorithm calculates Pi value. I am somewhat familiar with C language, but I am just starting to learn...
1
by: ofiras | last post by:
In bitmap, how can I find the nearest pixel (pixel 1) to a specific pixel (pixel 2) that has different color from pixel 2? Or how can I find a pixel in a specific distance from pixel 2 (like a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.