File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Feedback. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Feedback." Watch "Feedback." New topic


Stephen Foy
Ranch Hand

Joined: Oct 17, 2005
Posts: 143
Just finished this program, just looking for some opinions, is there any way i can improve this? is the coding messy? could i add more comments?

Stephen Foy - Microsoft Application Development Consultant
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Well at least you didn't put that pointless for loop the other person doing this same homework did. He did have the same code when n = 1 or n = 2 and you do two different things.

if (n ==1) { line2 = line5; line3 = line4;} // When there is no bytes left, changes lines.
if (n ==2) { line3 = line4; line2 = line6;} // When there is no bytes left, changes lines.

I think he made line2=line5 on both cases, might want to check your code or tell him about his error.

Besides that you can put all those strings as constants public static final declares in the class.

Public Static Final LINE_1 = " bytes of bits on the bus ";... etc instead of
String line2 = (" bytes of bits \nTake two down, \nshort them to ground. ");...

You can do away with the parenthesis.

What if caps locks is set?
I agree. Here's the link:
subject: Feedback.
jQuery in Action, 3rd edition