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.
Implement the spokedWheel & bikeTire methods of this morning's class & write the appropriate main to take advantage of them.
Let user decide which they want, the 4 spoked circles we started with or the 4x4 we ended with of bicycle tires.
|
|
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.
Notice there is some OVERLAP in the conditions for "at least 4" when all values are positive. In that case your code should DO BOTH. To handle the confusion, set each shape to a different semi-transparent color so that both are visible *AND* they should both be filled with a fully opaque outline.
Last week a few of you got to this section, and as I did not specify, you CHOSE one of the following file formats.
| Method | Description | Example File |
|---|---|---|
| FORMAT A |
#rows #cols1 #cols2 #cols3 ..... (exactly #rows of them!) then all the individual row array values as doubles | A.txt |
| FORMAT B |
#rows #cols1 then #cols1 individual row array values as doubles #cols2 then #cols2 individual row array values as doubles #cols3 then #cols3 individual row array values as doubles . . . for #rows of them | B.txt |
Notice there is some OVERLAP in the conditions for "at least 4" when all values are positive. For those who chose one way last time, I want you to SWITCH and modify your code accordingly this time. For those attempting this exercise for the first time, you may CHOOSE either.
All CLIENTS should include either MethodA or MethodB as part of the class name.
Once you have the above working... transparent colors & appropriate file format, Re-WRITE your code using a SEPARATE STATIC METHOD for each condition. Your submission for today should include BOTH versions -- without the extra methods and with the extra methods. Each with a different name though correctly indicating the file format used and both compiling.
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...
- Next, for each of the shapes (in their separate methods), try placing the calculated Euclidean coordinates into two array's x & y and plotting as a single filled & single framed polygon (MenuPolyClient.class).