[SOLVED] COMPSCI 230 Assignment ONE

$25

File Name: COMPSCI_230_Assignment_ONE.zip
File Size: 244.92 KB

5/5 - (1 vote)

COMPSCI 230 S2 Assignment 01

Computer Science

COMPSCI 230

Assignment ONE

Introduction

In this programming assignment, you are asked to add extra functions to the bouncing program. The aim of the assignment is to give you experience with oriented programming principles of inheritance and polymorphism.

Due Date

Due: 11:59 pm Friday 28th August 2015 Worth: 5% of the final mark

Introduction The Bouncing Program

The application, as given, is a simple bouncing program. Different shapes move around in various paths.

Set the current shape type

Set the current height & width

Set the current path type

Popup Menu

Actions
Shape Creation:
The user can create a new shape by clicking anywhere within the panel area of the program. The properties of the newly created shape are based on the current values saved in the appropriate UI fields (e.g. height, width etc).

Selecting/deselecting shapes:

A user can select a shape by clicking anywhere on the shape. If a shape is selected, all its handles are shown. The user can change the path types/widths/heights for all selected shapes by changing the current values with the help of the tools provided at the top of the application interface. (But the shape type cant be modified once a shape has been created.)

Clicking on a selected shape will deselect it.

Set the Animation speed

Tools

Shape Combo Box:

The Shape combo box sets the current shape type for new shapes. Clicking in the panel area for Shape Creation will create the selected type of the shape. A rectangle or a circle can be selected in the program.

Path Combo Box:

Users may select one of several moving paths for shapes from the Path combo box. Selecting a new path changes the path of all currently selected shapes. Additionally, the new path becomes the current path for any new shapes that are created.

Width TextField:

Users may change the current width of new shapes and currently selected shapes by entering a valid number in the width text field and pressing ENTER.

Height TextField:

Users may change the current height of new shapes and currently selected shapes by entering a valid number in the height text field and pressing ENTER.

Start Button:

Starts the animation.

Stop Button:

Stops the animation.

Animation Slider:

Users may use the animation delay slider to adjust the speed of the animation.

Popup Menu:

The application has a popup menu, which is activated by clicking the right mouse button anywhere in the panel area (on a windows machine). The popup menu contains a menu item called Clear All which allows the user to clear all shapes from the program.

1

COMPSCI 230 S2 Assignment 01

What you are to do

Firstly, become familiar with the program supplied. The files included in the program are as follows:

A1.java
AnimationPanel.java MovingShape.java
MovingRectangle.java MovingSquare.java

Download all source files from the assignment course page. The design and implementation of the program will be covered in lectures, please refer to the relevant material. It is strongly recommended to start as early as you can and implement the parts you know as soon as they are taught in lectures.

Your assignment is divided into several stages for ease of completion. Please complete the assignment in order of the stages.

Stage 1: Model the bounce package (5 marks)

Modelling is generally carried out when starting a new project to understand the problem to be solved and to assist with developing a software solution. However, modelling is also useful to help you understand how an existing piece of software works. This task involves reverse engineering a model from source code to help you understand the structure and behaviour of the Bounce application prior to developing it further in subsequent tasks.

In particular, you should construct a class diagram to model the static structure of the Bounce application. Your class diagram should capture the key classes and interfaces and the relationships between them.

The UML class diagrams need not be created using a tool. Hand-drawn diagrams should be clear and legible.

Assessment criteria

  • The class diagram should capture the different relationships correctly.
  • The class diagram should present a useful abstraction of the system.
  • The model comprising the class diagram should be well-formed.

    Stage 2: Using An ArrayList (10 marks)
    In this part you are required to modify classes in A1 which enable users to store instances of shapes using an ArrayList.

    Assessment criteria

  • Users should be able to create a new shape and add it into the ArrayList.
  • Users should be able to modify path/height/width of all the selected shapes in the ArrayList.
  • Users should be able to remove all shapes in the ArrayList.
  • Users should be able to draw all shapes in the ArrayList.
  • Users should be able to reset all margin sizes of all shapes in the ArrayList.

    Stage 3: Fill and Border Colours (10 marks)

    In this part you are required to modify classes in A1 which enable users to change the border and/or fill colours of all the currently selected shapes and the current fill and border colour that will be used when creating new shapes.

    When the user clicks on the Fill or Border colour button, a colour chooser is shown to the user. When a colour is selected, the corresponding foreground colour of the button should be changed. It shows the fill colour that will be used for new shapes. Changing the border colour should behave similarly.

The foreground colour of the Border button indicates the current border colour.

The foreground colour of the Fill button indicates the current fill colour.

2

COMPSCI 230 S2 Assignment 01

You are required to add two methods (setCurrentBorderColor and setCurrentFillColor) to the AnimationPanel class in order to set the colours of all the currently selected shapes and the colours that will be used when creating new shapes. You are also required to add two methods to the AnimationPanel class to return the fill/border colours (getCurrentFillColor and getCurrentBorderColor).

You should add the set and get methods to the MovingShape class in order to set or get the corresponding fill/border colour of shapes. You should modify the draw method of MovingRectangle class (and all subclasses) in order to use the fill/border color attribute stored in the superclass to fill/draw the shape.

Assessment criteria

  • Users should be able to change the default fill and border colours.
  • Users should be able to change the border colours of all selected shapes.
  • Users should be able to change the fill colours of all selected shapes.

    Stage 4: MovingCarLogo Class (10 marks)

You are now required to get creative and add your own selected car logo shapes that will make the Bounce program more interesting!

The MovingShape is an abstract class which contains two abstract methods: draw and contains. You are required to add a new subclass(es). You may need to implement some or all abstract methods for the new shapes. Why? You may also need to add a private instance field to store a specific property of the new shape. You will need to think carefully on the structure of the inheritance hierarchy.

A1 and AnimationPanel
Next, you are required to add a new ImageIcon to the Shape combo box control in the A1 class for each new type of shape. You are also required to modify the createNewShape method in the AnimationPanel class which allows users to create each new subclass instance.

Assessment criteria:

  • Users should be able to add a new shape(es) to the bounce program using the default fill and border

    colors, height, width and path.

  • Users should be able to change the width and/or height of the selected logos.
  • Users should be able to change the fill and and/or border colours of the selected logos.
  • Users should be able to change the bouncing path of the selected logos.

    Stage 5: Adding a New Path (10 marks)

    In this part, you are required to add your own designed path to the bouncing program.

    The MovingPath is an abstract inner class which contains an abstract method. You are required to add a new subclass which extends the MovingPath. You may need to add a private instance field to store a specific property of the new path. You will need to think carefully on the structure of the inheritance hierarchy.

    A1& MovingShape
    Next, you are required to add a new ImageIcon to the Path combo box control in the A1 class for each new type of path. You are also required to modify the setPath method in the MovingShape class which allows users to create a new subclass instance.

    Assessment criteria

  • Users should be able to add a new shape which bounce off using your own designed path.
  • Users should be able to change the bouncing path of the selected shapes to your own designed path.

3

Submission

COMPSCI 230 S2 Assignment 01

You may electronically submit your assignment through the Web Dropbox (https://adb.auckland.ac.nz/) at any time from the first submission date up until the final date. You can make more than one submission. However, every submission that you make replaces your previous submission. Submit ALL your files in every submission. Only your very latest submission will be marked.

Please double check that you have included all the files required to run your program and the A1.txt in the zip file before you submit it. No marks will be awarded if your program does not compile and run.

You are to electronically submit ONE A1.zip file containing all the following files:

  1. All source files (i.e. new, changed, and unchanged) Your name, UPI and a comment at the beginning

    of each file must be included in all your files.

  2. All gif files (used as icons in the program)
  3. UML class diagram in pdf format
  4. A1.txt

What to include inside the A1.txt file

You must include a text file named A1.txt in your submission. This text file must contain the following information:

  • Your name, login name and ID number
  • How much time did the assignment take overall?
  • What areas of the assignment did you find easy?
  • What areas of the assignment did you find difficult?
  • Which topics of the course did the assignment most help you understand?
  • Any other comments you would like to make.

    DO NOT SUBMIT SOMEONE ELSES WORK:

  • The work done on this assignment must be your own work. Think carefully about any problems you come across, and try to solve them yourself before you ask anyone for help.
  • Under no circumstances should you take or pay for an electronic copy of someone elses work. This will be penalized heavily.
  • Under no circumstances should you give a copy of your work to someone else
  • The Computer Science department uses copy detection tools on the files you submit. If you copy from

    someone else, or allow someone else to copy from you, this copying will be detected and disciplinary

    action will be taken.

  • To ensure you are not identified as cheating you should follow these points:

o Always do individual assignments by yourself.
o Never give another person your code.
o Never put your code in a public place (e.g., forum, your web site).
o Never leave your computer unattended. You are responsible for the security of your account. o Ensure you always remove your USB flash drive from the computer before you log off.

4

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] COMPSCI 230 Assignment ONE
$25