Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 13th, 2005, 3:45 PM   #1
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
Area and Perimeter

I need to make a program that does the following:

1) Allow the user to input the area of a square or a rectangle.
2) Display the perimeter of the object
3) Display the dimesions of the object.

The user only inputs the area, and the perimeter and the dimensions, the program is supposed to find. Can someone help me find the dimensions and perimeter?
Dark Flare Knight is offline   Reply With Quote
Old May 13th, 2005, 4:16 PM   #2
ZenMasterJG
Hobbyist Programmer
 
ZenMasterJG's Avatar
 
Join Date: Nov 2004
Location: Boston, MA
Posts: 148
Rep Power: 4 ZenMasterJG is on a distinguished road
Send a message via AIM to ZenMasterJG
Is this homework, or just somthing your trying to do yourself?
You'd have to assume that its a square, cuz with a rectangle the area can't determine the peimeter or dimensions.
ZenMasterJG is offline   Reply With Quote
Old May 13th, 2005, 5:58 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
It's simple: for a square, if the area is a^2, then the perimeter is 4a, and the dimensions are a by a. The program should be easy enough to write.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 14th, 2005, 10:51 AM   #4
Childe Roland
Newbie
 
Childe Roland's Avatar
 
Join Date: Mar 2005
Posts: 17
Rep Power: 0 Childe Roland is on a distinguished road
is there a method that lets you find the square root of a number?
Childe Roland is offline   Reply With Quote
Old May 14th, 2005, 10:58 AM   #5
HeX
Programmer
 
HeX's Avatar
 
Join Date: May 2005
Location: Kosova
Posts: 94
Rep Power: 4 HeX is on a distinguished road
Send a message via MSN to HeX
Quote:
Originally Posted by Childe Roland
is there a method that lets you find the square root of a number?
first you have to
import java.util.*;
and the method is:
Math.sqrt(number)
__________________
countdown++;
HeX is offline   Reply With Quote
Old May 14th, 2005, 11:03 AM   #6
Childe Roland
Newbie
 
Childe Roland's Avatar
 
Join Date: Mar 2005
Posts: 17
Rep Power: 0 Childe Roland is on a distinguished road
Thanks
Childe Roland is offline   Reply With Quote
Old May 14th, 2005, 11:05 AM   #7
HeX
Programmer
 
HeX's Avatar
 
Join Date: May 2005
Location: Kosova
Posts: 94
Rep Power: 4 HeX is on a distinguished road
Send a message via MSN to HeX
Anytime
__________________
countdown++;
HeX is offline   Reply With Quote
Old May 14th, 2005, 6:05 PM   #8
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
Quote:
Originally Posted by Ooble
It's simple: for a square, if the area is a^2, then the perimeter is 4a, and the dimensions are a by a. The program should be easy enough to write.
That is exactly what my teacher says but how do i get the dimensions? and i also need the optimum dimensions so it can also be a rectangle.

also, what does ^ mean?
Dark Flare Knight is offline   Reply With Quote
Old May 15th, 2005, 7:25 AM   #9
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
The optimum dimensions... you mean the smallest dimensions for the biggest area? Have fun with that - I cannot remember how to calculate those, but I think it may be trial-and-error. And a^2 means "a squared", or "a to the power of 2", so "^" == "to the power of".
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 15th, 2005, 11:23 AM   #10
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
Can someone else help me with this?
Dark Flare Knight is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:40 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC