Andy Jack wrote:Sorry, I cannot do your homework for you.
And, for what it is worth, you'll get the same response from a lot of folks here as you just got from Andy. On the other hand, you will also get a lot of offers to help you figure out how to solve your problems, which, in the long run, is much more valuable.
If you need a nice visual and beginner friendly book, then try 'head first java'. By the way, which book are you using in class ?
"Head First Java" is pretty popular in this forum. I bought it and discovered it was simply not for me. It uses a very whimsical, deliberately irreverent approach, which I am sure will be ideal for lots of people. I'm much more of a by-the-numbers guy, so I tend to start a new language with one or another of the "Teach Yourself <whatever> in <some ridiculously abbreviated number of> [hours | days |weeks]" books that are available everywhere. For new programmers (that is, folks learning how to program for the very first time), I would not recommend any of those. You can get a program written and running, but you'll often do it by using portions of the language selectively chosen by the author to make good on the title's promise (of getting you to where you can say you wrote a program in a ridiculously abbreviated time-frame), and that often leads to learning bad practices at a time when you are unable to recognize them as such.
Now, the good news is that your assignment may seem long and tedious, but each of the individual steps (except for the rather cryptic step d) are among the simplest operations you will ever have to do. Please do let us know what textbook you've got. There are lots of book reviews on this site, as well as many discussions in the forum about which books people like (or not) and why (or not).
In my little library, I have these:
Murach's Java SE 6 - If yours is the mind of a clockwork robot, and you like doing things in itty-bitty steps that add up to your goal in the long run, try this one.
Java, the Complete Reference - If you don't let the fact that it is an intimidating size put you off (in spite of the fact that the title is utterly absurd, given the number of times the author declares some aspect of Java to be "beyond the scope of this book"), this one can also be a first book on programming, and it is a little more warmly written than the Murach volume, if also somewhat more prolix.
Core Java, Volumes I and II - Everyone should have these, but I wouldn't suggest you start with them.
Sam's Teach Yourself Programming with Java in 24 Hours - This one got me going, but I was a programmer (for decades) already, and I also hear that the latest edition is generally pretty roundly panned. Avoid this one.
Killer Game Programming in Java - Author has some funny ideas about frame rates that seem to dominate the first section of the book. Good someday if you want to write games, though probably better if you pick one that uses something you'll learn about later, called, "JavaFX."
Effective Java - Wildly popular here and certainly something to have after you are past the most basic stuff. Not a textbook; more of a memoir containing lots of good advice.
Head First Java - See above (or, if you want mine, send me twenty bucks and it's yours
)
Java Phrasebook - nah, skip this one.
Java Pocket Guide - Handy, from time to time, but only as a portable reference you don't really need if you have an internet connection.
I do have to agree with Andy: sometimes, it just ain't a game. Programming can be lots of fun and very mind-expanding. But I have said for nearly 40 years now that learning to program for the first time is kind of like storming a castle: there are many different ways to reach your objective, but there's no way out of dealing with the alligators in the moat.