Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   Finding All Sides and Angles of a Triangle (http://www.programmingforums.org/showthread.php?t=13210)

ReggaetonKing May 25th, 2007 12:44 PM

Finding All Sides and Angles of a Triangle
 
1 Attachment(s)
In my Trig class, we are going over Laws of Sin and Heron's Formula. I am making a program where a user can enters the angles and the side of a oblique triangle and whatever is left blank the program will calculate the rest sides and angles that the user did not enter.

My program can also calculate the area if all the sides of the triangle are given.

Knowing the math and formulas is not a problem for me, The problem is just figuring out which sides and/or angles to calculate. Instead of having a thousand if statements!

Here is my source for far. I attached a .zip file containing my source.

Help will be greatly appreciated!

Wizard1988 May 25th, 2007 8:16 PM

You might also want to check out the law of cosines.
http://en.wikipedia.org/wiki/Law_of_cosines

physicist May 26th, 2007 12:40 AM

i agree. law of cosines can solve some problems that take more steps with the other two formulas

crawforddavid2006 May 26th, 2007 2:59 AM

Quote:

Originally Posted by reggaeton_king (Post 128272)
The problem is just figuring out which sides and/or angles to calculate. Instead of having a thousand if statements!

use 500 if statements instead, i think 1000 is a few too many:D

pegasus001 May 26th, 2007 5:54 AM

Quote:

Originally Posted by reggaeton_king (Post 128272)
The problem is just figuring out which sides and/or angles to calculate. Instead of having a thousand if statements!

The law of sine and cosine aren`t constrained by the names of the angles or sides. The user just has to input the values and according to them the program has to evaluate the answer. Just put the picture triangle and tell the user to input the values accordingly. :)


All times are GMT -5. The time now is 2:36 AM.

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