![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4
![]() |
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? |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
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. |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
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.
|
|
|
|
|
|
#4 |
|
Newbie
Join Date: Mar 2005
Posts: 17
Rep Power: 0
![]() |
is there a method that lets you find the square root of a number?
|
|
|
|
|
|
#5 | |
|
Programmer
|
Quote:
import java.util.*; and the method is: Math.sqrt(number)
__________________
countdown++; |
|
|
|
|
|
|
#6 |
|
Newbie
Join Date: Mar 2005
Posts: 17
Rep Power: 0
![]() |
Thanks
|
|
|
|
|
|
#7 |
|
Programmer
|
Anytime
![]()
__________________
countdown++; |
|
|
|
|
|
#8 | |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4
![]() |
Quote:
also, what does ^ mean? |
|
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
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".
|
|
|
|
|
|
#10 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4
![]() |
Can someone else help me with this?
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|