Assignment 3

Do one (1) of the following assignments:

3a. Random Walk


Drawing things on Screen!

Drawing simple objects on screen is not something we covered, but it can easily be done in a C# windows form program. In this assignment you are going to draw very simple objects and use our friend the random number generator to create artwork!


Here is the problem

Create a program that does the following:

  • ask the user the size of a form (Max 800 x 800, Min 200 x 200)
  • ask the user the size of a target (Max 100 x 100, Min 20 x 20)
  • it will then generate a form the correct size and place a "red" target randomly on the form the size asked
    • remember the boarder of the form counts in the "size" calculation
  • the program will then randomly pick a point on the form (not inside the target)
  • it will then generate a new position for the second point (it can be 1 above or one below or the same Y value, it can be 1 left or one right or the same X value)
    • it must be on the form though!
  • it will then draw this point
  • it will keep drawing the points until it touches the target

The position of the point MUST be saved in an ADT (or interface or class).

If you need my help figuring out how to draw points and geometric objects, I can but it will cost you one (1) partial level for each drawing thing I help you with!


Two part assignment

This is a 2 week assignment:

  • Week 1 hand in DESIGN ONLY
    • Top-down, Flow-chart (but not pseudo-code) and test cases (to describe some test cases you will be looking for)
  • Week 2 hand in EVERYTHING ELSE
    • plus the stuff from part a

Each week ENSURE you include the Marking Rubric


Things to note

  • If you are not sure on any part of the problem, just ask me and I will give you additional information
  • You must do the program in Java first (get a 3+).
  • You can get a higher mark by changing the shape from a rectangle to a circle (4*) or an oval (4+)
  • See Marking Rubric below
  • Ensure you work through (in order):
    • Top-down
    • Flow-chart
    • Test cases
    • Final, debugged, commented code
    • Screen shot proving test cases are correct
  • Ensure you follow the "Hand in Process"

3b. Binary Search


More ways to Search!

There are many ways to to search for items. The great things about a Binary Search is that it is really fast, since it is a divide and concur strategy. The problem is that to make it work, you have to ensure that the list is always ordered.


Here is the problem

Create a program that will generate a random list of 250 values and present them to the user. Then the list is sorted and presented to the user again. Finally you enter a number to be found. If the number is in the list, the position will be returned. If it is not in the list, the user will be informed of this. You CAN NOT use any "sort" or "search" function built into your programming language, you must write a binary search function to find the item yourself!


Two part assignment

This is a 2 week assignment:

  • Week 1 hand in DESIGN ONLY
    • Top-down, Flow-chart (but not pseudo-code) and test cases (to describe some test cases you will be looking for)
  • Week 2 hand in EVERYTHING ELSE
    • plus the stuff from part a

Each week ENSURE you include the Marking Rubric


Things to note

  • If you are not sure on any part of the problem, just ask me and I will give you additional information
  • You must do the program in Java first (get a 3+).
  • You can get a 4+ if your program will let the user "add" another number to the list. It will ask for another number and then automatically place it in order in the list.
  • See Marking Rubric below
  • Ensure you work through (in order):
    • Top-down
    • Flow-chart
    • Test cases
    • Final, debugged, commented code
    • Screen shots proving test cases are correct
  • Remember to think, Input – Process – Output, when designing your program
  • Ensure you follow the "Hand in Process"