1 Using the Web-CAT homework submission system
2 Methods for simple classes
3 Simple drawings
4 Methods for complex data
Version: 5.2.1

Lab 3

Goals: The goals of this lab are to learn how to follow the design recipe for designing methods in Java.

Of course, as the part of the design recipe, we will learn how to design tests for our methods and how to run them.

For a simple tutorial on how to design the tests using the tester library look at the wiki pages on the JavalibTester github site.

1 Using the Web-CAT homework submission system

For the rest of the semester we will use the Web-CAT homework submission and grading system.

In the lab today we will make sure every student can submit their work individually, we will then make sure every pari can submit the homework that is due tonight.

Follow the link to our Web-CAT server and log in.

Find Assignment 1 and upload the file Shapes.java that we had worked on during the last lab.

Check that the file has been submitted correctly.

2 Methods for simple classes

Last week we started designing methods for the class Person that referred to the person’s Address. We have designed the method sameCityState that told us whether this person lived in the same city (and state) as the given Person.

Design the following additional methods for the classes Person and Address you have defined during the previous lab:

3 Simple drawings

In this simple exercise you will se how you can design images from geometric shapes as well as image files and some text.

4 Methods for complex data

In class we have designed a data representation for mobiles as follows:

             +---------+

             | IMobile |<---------------+

             +---------+                |

             +---------+                |

                 |                      |

                / \                     |

                ---                     |

                 |                      |

       ---------------------            |

       |                   |            |

+--------------+   +---------------+    |

| Simple       |   | Complex       |    |

+--------------+   +---------------+    |

| int length   |   | int length    |    |

| int weight   |   | int leftside  |    |

| IColor color |   | int rightside |    |

+--------------+   | IMobile left  |----+

                   | IMobile right |----+

                   +---------------+