Lab 3
Get started now

Objectives

  • Translate UML class diagrams into source code
  • Construct software which using an abstract class and polymorphism
  • Employ aggregation and composition in the development of software
  • Use javadoc to determine appropriate use of an unfamiliar class

Assignment

Shape Implementations

Your assignment is to write the Shape, Point, Triangle, LabeledTriangle, Rectangle, LabeledRectangle, and Circle classes. The classes are part of an inheritance hierarchy that is shown in the UML class diagram below. Note that the Shape class is an abstract class. Also, be sure that your implementation adheres to the visibility modifiers shown in the diagram.

Place each of these classes in a package that uses your MSOE username as the name.

Implementation specific details for these classes is found in the javadoc for these classes.

Please note that the class named Lab3 in the above diagram should be named ShapeCreatorApp.

ShapeCreatorApp

The ShapeCreatorApp class has already been implemented. You will need to add the correct import statement(s) for your shape classes. No other changes need to be made to the ShapeCreatorApp class.

The program makes use of the classes that you must implement to create the following:

WinPlotter

The program relies on the WinPlotter class. Dr. Hornick wrote the WinPlotter class, and the documentation for the class may be found here. You will need to download and then add the WinPlotter.jar file to your build path (see instructions below).

Accessing the .jar File

For this assignment, you will need to make use of the WinPlotter.jar.

In order to be able to access the WinPlotter class in the .jar file:

  1. Create a libs folder in your IntelliJ project folder
  2. Download the WinPlotter.jar file and save it in the newly created libs folder.
  3. Select File -> Project Structure
  4. Select Modules from the Project Settings on the left
  5. Select the Dependencies tab on the right
  6. Select the + on the far right
  7. Select Libraries -> Java from the drop-down menu
  8. Select the libs folder you created above and click OK
  9. In the Configure Library dialog box that appears, accept the default settings: Name = libs and Level = Project Library
  10. Click OK to close the Project Structure window

You should now have access to the edu.msoe.se1010.winPlotter.WinPlotter class in your project code.

Details

  • Every class in this inheritance hierarchy, except the Shape class implements the draw method.
  • The draw methods all take a single argument, which is a reference to the WinPlotter object created at the beginning of the main method in the ShapeCreatorApp class. As a result, all shapes use the same WinPlotter object for drawing.
  • Each implementation of the draw method must use methods from the WinPlotter class to draw the desired shape.
  • To help you understand what you must write for each class (and how to draw each shape), read the Javadoc for the Shape-derived classes.

Just For Fun

Feel free to create your own version of the ShapeCreatorApp class that draws a picture of your own choosing. You can submit a screen shot of this as the supplemental file on the upload page.

Lab Deliverables

See your professor's instructions for details on submission guidelines and due dates.
Dr. Taylor's students: See below
All other students should refer Blackboard
If you have any questions, consult your instructor.

Acknowledgment

This laboratory assignment was developed by Dr. Mark Hornick and Dr. Chris Taylor.

Monday, 27-Nov-2017 02:58:37 CST