[PJUG Javamail] HELP!! Student Newbie is flailing about
Leslie Martin
ldmartin1959 at me.com
Sun Aug 14 17:25:16 UTC 2011
I'm a first-termer in Java at PCC. I'm in a bit over my head on this (never having done any formal programming languages before) and still struggling some with the basics. I'm stuck on an assignment and I need some direction. I'm not looking specifics, please, just enough direction to help me find my way. Also, we are using BlueJ in this course (for what-ever that's worth for the sake of this discussion). Also, please keep in mind that I am barely comprehending some of this, so you will have to type slowly for me to understand what you're saying!! :)
Also, time is of the essence! Although the assignment isn't due until mid-day Wednesday, I have only about 1/3 of the way through and I have work in several other courses that also are demanding my time (plus a wife who makes the same demands!!).
Here is the section of code I'm having trouble with.
HashMap<String, Color> ballColor = new HashMap<String, Color>();
ballColor.put("0", Color.blue);
ballColor.put("1", Color.red);
ballColor.put("2", Color.yellow);
ballColor.put("3", Color.black);
HashMap<Integer, Integer> ballSize = new HashMap<Integer, Integer>();
ballSize.put(0, 10);
ballSize.put(1, 12);
ballSize.put(2, 14);
ballSize.put(3, 16);
ballSize.put(4, 18);
ballSize.put(5, 20);
/**
* create, place and show the balls
* ball starting x-position is 10 plus (the current ball number*20) to provide a little space
* ball starting y-position is 275, near the top of the canvas
* ball diameter is pulled from HashMap BallSize
* ball color is pulled from HashMap BallColor
*/
/**
* have to initialize howManyBalls to '1' to make the math work
*/
int howManyBalls = 1;
if (Integer.toString(quantity) == null) {
bounce();
} else {
// create the balls
while(howManyBalls <= quantity) {
int xMarksTheSpot = 10+howManyBalls*20;
int howBigTheyAre = 6%howManyBalls;
Color manyColors = ballColor.get(Integer.toString(4%howManyBalls));
iGotBalls.add(new BouncingBall(xMarksTheSpot,10, howBigTheyAre, manyColors, ground, myCanvas));
Instead of the value from the HashMaps being inserted into the last line at howBigTheyAre and manyColors I am getting the key for howBigTheyAre and <object reference> for manyColors. So, I'm thinking I need some function to pull the values out, but I cant figure out what.
If anyone can give me some direction on this, I'd really appreciate it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://javac.com/pipermail/javamail/attachments/20110814/09f655c2/attachment-0002.html>
More information about the Javamail
mailing list