Homework 9
Kaitlyn Monteer
MU ID: 005553861
5 April 2011
E8.1
Design document
| Class | Purpose |
| Point | Container for program. |
Program diagram
Developments steps
- Create new project called Point.
- Change program file name to Point.
- Change class declaration to Point instead of main.
- Right-click the Point file and select Reverse Engineer.
- Create new class diagram.
- Drag and drop the class option to the window.
- Change class name from Untitled to Point.
- Change the main method to public int manhattanDistance(Point other)
- Save the diagram and drag and drop it to the Point file.
Test results
| Step | Expected Output | Actual Output |
| 1 | None | None |
| 2 | None | None |
| 3 | None | None |
| 4 | None | None |
| 5 | None | None |
| 6 | None | None |
| 7 | None | None |
| 8 | None | None |
| 9 | None | None |
E8.13
Design document
| Class | Purpose |
| Rectangle | Container for program. |
Program diagram
Developments steps
- Create a new project called Rectangle.
- Change the java file name to Rectangle.
- Change the class declaration to Rectangle.
- Right-click the java file and select Reverse Engineer.
- Create a new class diagram for the Rectangle class.
- Drag and drop the class option to the window.
- Change the class name from Untitled to Rectangle.
- Change the main method to public Rectangle(int x, int y, int width, int height)
- Add the attributes int x, int y, int width, int height.
- Add the method public String toString().
Test results
| Step | Expected Output | Actual Output |
| 1 | None | None |
| 2 | None | None |
| 3 | None | None |
| 4 | None | None |
| 5 | None | None |
| 6 | None | None |
| 7 | None | None |
| 8 | None | None |
| 9 | None | None |
| 10 | None | None |
P8.1
Design document
| Class | Purpose |
| RationalNumber | Container for program. |
Program diagram
Developments steps
- Create new project called RationalNumber.
- Change file name from Main.java to RationalNumber.java.
- Change class declaration from Main to RationalNumber.
- Right-click the RationalNumber.java file and select Reverse Engineer.
- Create a new class diagram of RationalNumber.
- Drag and drop the class option to the window.
- Change the class name from Untitled to RationalNumber
- Change the main method to public RationalNumber(int numerator, int denominator).
- Add the attributes int numerator and int denominator.
- Add the method public String toString().
Test results
| Step | Expected Output | Actual Output |
| 1 | None | None |
| 2 | None | None |
| 3 | None | None |
| 4 | None | None |
| 5 | None | None |
| 6 | None | None |
| 7 | None | None |
| 8 | None | None |
| 9 | None | None |
| 10 | None | None |
References
Sun Microsystems. (2004). Scanner (Java 2 Platform SE 5.0). Sun Microsystems, Inc., Santa Clara, CA USA. [Online]. Available http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html
No comments:
Post a Comment