Q7: Extending Bubbles

Table of Contents


Objectives

  • Learn about colors and transparency.
  • Practice using loops to position objects.
  • Make use of arrays to position objects.
  • Use pair programming to solve problems.

Academic Honesty

Read the Scholastic Honesty Policy and Assignment Integrity policies of the syllabus. Here are some clarifications for this particular assignment:

  • You are expected to work with one other student of this class following the rules of Pair Programming for Homework Assignments.
  • You may copy small portions of the code from the textbook or the instructor's web pages.
  • You may get help from people other than your pair-programming partner if you get stuck, but only if they do not show or tell you the code to type. Instead they should show you other examples that you can adapt to your code.
  • Do NOT copy or modify code from, nor provide code to, any other student or unauthorized source.
  • Do NOT give a copy of your code to your designated pair-programming partner if you did not develop the code together.

Project Crafting Specifications

Quests

Complete the following quest specifications to meet the objectives.

Project 1: Pair Programming Worksheet

  1. Watch the video Introduction to Pair Programming, a professionally developed video (10 minutes).
  2. Save this Pair Programming Worksheet following the menu File > Download as > Plain Text (.txt), and save the file as pairprogramming.txt.
  3. Fill out and answer the questions in pairprogramming.txt without deleting any of the existing text.
  4. Submit the pairprogramming.txt file with the rest of the assignment as described in Deliverables.
  5. For reference, here is a link to the The Rules of Pair Programming

Project 2: Extending Bubbles

This project is based on a scenario from the end of chapter 6 in the textbook.

  1. Work with one other student following the rules of Pair Programming for Homework Assignments.

    If you cannot find a partner, talk to the instructor right away. If there are an odd number of students, the instructor may assign one group of three students.

  2. Start with the completed bubbles scenario we worked on in class, or the scenario from the end of chapter 6 in the textbook if you do not have the in-class scenario.
  3. In the world subclass, create a new private method named setup(). Call this method from the constructor. In this method, create a new bubble, using the default constructor of Bubble, and place it in the middle of the world.

    The prepare() method is not needed or allowed, so remove it if you have one.

  4. Add a while-loop to the setup() method that places 11 bubbles randomly in the world.
  5. Add a for-loop to the setup() method that creates 21 bubbles along a diagonal with an x and y distance of 30. The first bubble at (0,0), the next at (30, 30), then (60, 60), and so on. The last bubble will be at (600, 600) for 21 bubbles.
  6. Add a second for-loop to the setup() method that places 12 bubbles on a horizontal starting at x=200, y=100, with x increasing by 40 each iteration and y remaining constant at 100. Thus the first bubble is at (200, 100), the next at (240, 100), then (280, 100), and so on. The size of the bubble must increase as well, stating with a size of 10 for the first bubble and increasing in size by 10 each iteration of the loop. Use the Bubble constructor with one parameter to set the size.
  7. Add a third for-loop to the setup() method that creates 19 concentric bubbles at the center of the world. The bubbles start with a size of 190, decreasing by 10. The last bubble has a size of 10. Make sure to create the largest bubble first and the smallest last, so you have bubbles of sizes 190, 180, 170, and so on , all lying on top of each other.

    Use the constructor of Bubble with two parameters to set the initial direction (see exercise 7.4 step 5). Set the direction of the first bubble at 0, the second at 20, the next at 40, and so on. Notice that the direction of each subsequent bubble is increasing by 20 degrees. When the scenario runs, these overlapped bubbles expand outwards in all directions from the center of the world.

  8. Add two integer arrays, one named xDiag and the other named yDiag, to store the (x, y) coordinates for positioning bubbles from the upper right-hand corner of the screen to the lower left-hand corner of the screen. Create and position 24 bubbles and make sure each array has 24 elements. Use a for-loop to read the coordinates for the position of each bubble.
  9. Update the Scenario Information (README.TXT file) for your project to fill in all the Greenfoot supplied information like your name, project title and version or date, as well as providing the current status. Include the name of your pair-programming partner. Even though the project file may not include the usual labels, like those shown below, please add them.
  10. PROJECT TITLE: Bubbles
    PURPOSE OF PROJECT: Draw bubbles at specified positions.
    VERSION or DATE: MM/DD/20YY
    HOW TO START THIS PROJECT: Press run after compiling,
    AUTHORS: Your Name (and Pair Programming Partner)
    USER INSTRUCTIONS: Watch the pretty bubbles!
    
  11. Submit a zip file (with all source code) of your bubbles project to Canvas as explained in the section of this document: How to Submit.

Project Extra Credit

Adding the following are worth extra credit points:

  1. Add a 3 parameter constructor to the Bubble class with the following signature: (1 point)
    /**
     * Create a Bubble with the given size, initial direction and speed.
     *
     * @param size Overall diameter of this bubble.
     * @param direction Initial direction in which this bubble moves.
     * @param speed Rate this bubble moves in pixels per act cycle.
     */
    public Bubble(int size, int direction, int speed)
    

    The constructor must implement the specified parameters.

  2. After completing extra credit 1, add two more arrays to store the (x, y) coordinates, one named xName and the other named yName, for positioning bubbles arranged in the shape of your initials in the upper right quadrant of the world. Two letters of your initials is enough and the size of each letter must be at least 4 x 5 bubbles. Use a for-loop to read the coordinates for the position of each bubble and call the three-parameter constructor with a speed of 0. Pair programming on this extra credit is optional but requires both sets of initials. (2 points)

Make certain that your README.TXT file describes any extra credit attempted.

Grading Criteria

The instructor will evaluate your assignment using the following criteria. Each criteria represents a specific achievement of your assignment and has a scoring guide. The scoring guide explains the possible scores you can receive.

Some scoring guides have a list of indicators. These indicators are a sign of meeting, or a symptom of not meeting, the specific criterion. Note that a single indicator may not always be reliable or appropriate in a given context. However, as a group, they show the condition of meeting the criterion.

For information on grading policies, including interpretation of scores, see the syllabus page.

Pair Programming Worksheet

  • 4: Student completed and submitted the learning worksheet with masterful effort
  • 3: Student completed and submitted the learning worksheet with substantial effort
  • 2: Student completed and submitted the learning worksheet with minimal effort
  • 1: Student submitted the learning worksheet
  • 0: No learning worksheet submitted

Project 2 Compilation

  • 4: Source code compiles with no errors or warnings
  • 2: Source code compiles with warnings
  • 0: Does not compile, not turned in, or wrong folder name

Project 2 Functionality

  • 10: Demonstrates mastery of the assignment
    • Has extra features or demonstrates techniques beyond the assignment
    • Applies concepts from the lesson(s) appropriately
    • Meets all specifications with particularly elegant solutions
    • No errors encountered during operation
  • 8: Has all the functionality expected of the assignment
    • Demonstrates many techniques from the lesson
    • Meets all specifications
    • Implementation seems more complicated than necessary.
    • May have one minor error
  • 6: Has most of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Meets all but one of the specifications
    • Implementation seems excessively complicated.
    • May have 2-3 minor errors
  • 4: Has some of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Meets at least 1/2 of the specifications
    • Implementation seems excessively complicated.
    • May have more than 3 minor errors
  • 2: Serious functional problems but shows some effort and understanding
    • Meets less than 1/2 of the of the specifications
    • Has a major error or many minor errors
    • Implementation seems very convoluted
    • Demonstrates few techniques from the lesson
  • 0: Does not execute, no specifications met, or wrong folder name
  • -2: penalty for not pair programming

README.TXT File for Project 2

  • 2: README.TXT file submitted with specified information included
  • 1: README.TXT submitted but some information was not included
  • 0: No README.TXT submitted or wrong folder name

Maximum Score: 20, plus extra credit

Deliverables

Follow these instructions carefully and exactly to turn in your quest (assignment) to Canvas and maximize your XP:

  1. Create a folder named "project" (no extra characters) and place your complete programming scenario into this folder.
  2. Add the pairprogramming.txt worksheet to the folder.
  3. Zip the folder and submit the zip file to the Q7: Extending Bubbles slot of Canvas.

Please do not add any extra characters to the above folder names. Also, do not put any spaces or special characters like #, : or $ in zip file or folder names. Your crafted code must work as submitted. Remember to test and double check your files before and after submitting them. If you make a mistake, you can resubmit up to the deadline but must resubmit all your quest files.

Home | Canvas | Schedule | Syllabus | Room Policies
Help | FAQ's | HowTo's | Links
Last Updated: October 24 2017 @18:54:25