Hello again everybody, just like to say thanks for the help I've gotten so far! Now, onto the problem at hand, I'm designing a program to calculate the following when a ladder is placed perpendicularly to a wall (at a right angle)

the angle between the ladder and the ground (bottomAngle);
the length of the ladder (ladderLength);
the distance of the bottom of the ladder to the wall (floorLength); and
how long it would take an object to reach the floor if dropped from the top of the ladder (dropTime)

My question is, in the UML, do I have to declare everything I am finding as a varialbe/(field, as I've seen it called sometimes??)
topAngle and verticalHeight are going to be user input, and valueGravity is constant
Is this everything I need to include, because everything else is being calculated, but is NOT being used in itself, to calculate another value?

A few things:
1. A right angle is, by definition, exactly 90 degrees.
2. Assuming the wall is a normal, perfectly vertical wall, then a ladder placed perpendicular to it would be perfectly horizontal.
3. I don't see a use for a UML diagram here but if it's for school, you should ask your teacher for clarification. I suspect you don't need to include intermediate variables.
4. Do the calculations by hand first, then translate the calculation process into code.

Rykurex Peters wrote:Now, onto the problem at hand, I'm designing a program to calculate the following when a ladder is placed perpendicularly to a wall (at a right angle)

Just to add to Junlu's good advice, there are usually only 2 things you need to construct a right-angle triangle:
1. Theta (the angle between hypotenuse and base), plus the length of any known side, or
2. The length of any two known sides.
And you've been given the latter. Everything else can be derived, so there's no need to store anything more.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here

My question is, in the UML, do I have to declare everything I am finding as a varialbe/(field, as I've seen it called sometimes??)

Your UML class diagram should contain all the class fields. Local variables (that you use inside your methods) should not be in UML class diagram.

E.g., if you're calculating dropTime in some method, the method should be in UML diagram, but the variable dropTime should not.

The quieter you are, the more you are able to hear.

Rykurex Peters
Greenhorn

Joined: Oct 28, 2012
Posts: 21

posted

0

My apologies, I typed something then deleted it, then didn't read over my sentence again. I meant the floor is perpendicular to the wall, there's no point in putting a ladder on the ground now is there :P?
Thanks to you all, I understand it now, I think my UML code is correct going by what Kemal said and thanks for the extra tip of working everything out by hand first, it'll certainly be useful for testing