r6 - 27 Mar 2007 - 20:30:14 - DarrinRotheYou are here: TWiki >  DrRothe Web  >  SoftwareComponentDesign > PolymorphismExercise

PolymorphismExercise

Objectives Addressed

  • understand the use of UML in the design process
  • be able to use computer-aided software engineering (CASE) tools in the design process

Overview

The purpose of this lab is to become familiar with modeling classes and performing code generation with Enterprise Architect.

Problem Statement

Use Enterprise Architect to model the following design:

  1. We wish to write an application that can draw various shapes. For this assignment, you need to support a circle, a line and a rectangle. These entities should be derived from an abstract base class called Shape, with the intention that the using program will store a collection of shape objects.
    1. All shapes should have a property to keep track of the line color of the shape (use an integer for now).
    2. All shapes should have a property to keep track of the fill color of the shape (use an integer for now).
    3. All shapes will need a draw() method. This should be made abstract (pure virtual) in the base class, which will force all shapes to implement the function.
    4. Each shape will need to store its location and size. It is up to you to decide how to store this information, and it may need to be unique for each shape. At some point, X and Y coordinates will need to be used. For any coordinates necessary, each shape should compose instances of a utility class Point, which simply stores two integers (assigned via constructor) and has setters and getters for each element of the coordinate (yes, I know Java has one of these already).
    5. Each shape will need a variety of constructors to initialize the colors, location, and size.
  2. Include a sequence diagram depicting the creation of one line, one circle, and one rectangle, storing them in an ArrayList?, then iterating the list and calling draw() on each shape.
  3. Generate code via Enterprise Architect.
  4. Fill in code - you do not need to actually code the draw() methods. Just have the methods print a line to the console indicating that they are drawing a circle, line, or rectangle. Include coordinates and colors if you want an A :).
  5. Write a driver that implements you sequence diagram

Resources

Deliverables

DrRothe?

  • Due 11:00pm, the day prior to Week 2 lab
  • Submit a log of time spent on this assignment to FAST.
  • Prepare a zip file (not rar, not gzip...) with the following items in it:
    • Your EA file - it should have a class diagram and a seqence diagram in it and nothing else.
    • A text file with commentary on the assignment - name it report.txt
      • Problems encountered and how you solved them
      • Any questions that remain
      • Conclusions
      • Suggestions for improvements
    • All source code written by you (and EA in this case)
    • A text file named manifest.txt. Within manifest.txt, list your email address, and all of the text and source files included (do not list EA file).
  • Submit via electronic submission at online submission as Lab 1.

DrTaylor?

  • Due 11:00pm, the day prior to Week 2 lab
  • Submit a log of time spent on this assignment to FAST.
  • Prepare a zip file (not rar, not gzip...) with two .png or .gif images in it:
    • Screen capture of your UML class diagram from EA (use filename: 2811MSOEloginL1a.png where MSOElogin is replaced with your login name).
    • Screen capture of your UML sequence diagram from EA (use filename: 2811MSOEloginL1b.png).
  • Prepare an XML report that contains:
    • Links to the class and sequence diagrams
    • A brief discussion of the most challenging aspect of the assignment and the most interesting aspect of the assignment
    • All documented source code written by you (and EA in this case)
  • Submit the zip and XML files via the electronic submission.
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r6 < r5 < r4 < r3 < r2 | More topic actions
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback