arr2D & StdDraw
arr2D & StdDraw

Today everyone working gloriously alone.

Required Working Style for Today's Lab:

  • From beginning to end you will work in a folder which contains all your work for today's lab.

  • Before you leave, you will email me all the files necessary to run your application.
  1. Array Exercises

    Work on the exercises listed on page we started looking at this morning.

    1. Set up a scanner, re-direct standard input & read in a 2d array all at once.

    2. WHEN YOU ARE DONE... add more loops below to

      accomplish any 4 of a) thru g) (For square, regular, &ragged arrays)

      accomplish any 4 of h) thru n) (For square, regular, &ragged arrays as it makes sense)

  2. Arrays & If-stmt(s)

    Make your scale 0,30 for x & y

    Given(ie,scanner) a ragged array of doubles, write a program which responds in the following way to each row.

    • If a row has exactly 3 elements use them as x,y,r to create a circle or square. Every time the circle or square should be determined randomly by your program.

    • If a row has at least 4 elements and all are positive, use them to create an ellipse as x,y,r1,r2

    • If a row has at least 4 elements and the first 2 are positive while the next two have different signs, use them to as x1,y1,x2,y2 to create a line after first taking the absolute value of any which are negative.

    • If a row has at least 4 elements and the first 2 are positive and the next two have the same sign as each other (both negative or both positive) use them as x,y,r1,r2 to create rectangle after making sure all are positive

    • Otherwise ignore the row and go on to the next row until all rows have been dealt with.

  3. Polar Equations....and arrays
      1.5.21   polar equation curves
      Start from the provided code which .... plots a circle.

      A circle can be described using a polar equation.

      r = 1

      This starter set of code plot's that simple equation. Notice how x & y are computed in the loop.

      UnitCircleClient.java

      (LabeledUnitClient.class)

      1.5.21 suggests some more interesting equations. Try them...

      Make a menu of possibilities. Here's one I made

      MenuClient.class

      Next try placing the calculated Euclidean coordinates into two array's x & y and plotting as a single filled & single framed polygon (MenuPolyClient.class).

      I have a brief handout and you may use browser and look up equations of more polar curves....