This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UML and Variables

 
Rykurex Peters
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

RATriangle
________________
-verticalHeight
-topAngle
-valueGravity
________________
-bottomAngle
-ladderLength
-floorLength
-dropTime
+getBottomAngle
+getLadderLength
+getFloorLength
+getDropTime

Or do I also need to include bottomAngle, ladderLength etc etc?

Thanks guys <3
 
Junilu Lacar
Bartender
Pie
Posts: 6529
21
Java Linux Mac Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Winston Gutkowski
Bartender
Pie
Posts: 9477
50
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rykurex Peters
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad we could help!

Also, I think this might be a topic for OO, Patterns, UML and Refactoring forum, but that's up for someone with higher rank to decide.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic