Thread: hay
View Single Post
Old Mar 3rd, 2008, 7:32 AM   #5
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 332
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
Re: hay

use white space formating like this. Use 4 spaces instead of tabs(set in editor), use tabs for inside methods, classes, if and loops. Place spaces between operands and operators. It makes the code more "human readable".

java Syntax (Toggle Plain Text)
  1. public class Test
  2. {
  3. public static main void(Strings[] args)
  4. {
  5. int x = 1;
  6. int total = 0;
  7. int t1 = 0;
  8.  
  9. for(int j = 0; j < 3; j++)
  10. {
  11. System.out.println("Box 00" + (j + 1) + "");
  12. x = 1;
  13. total = 0;//re-initialize the individual box total
  14.  
  15. while(x! = 0)
  16. {
  17. System.out.print("Input egg wegiht ");
  18. x = input.nextInt();
  19. total = total+x;
  20. }
  21.  
  22. System.out.println("Total wegiht of the box : " + total);
  23. System.out.println();
  24. t1 = total + t1;
  25. }
  26.  
  27. System.out.println("Grand Total :" + t1);
  28. }
  29. }
__________________
i dont know much about programming but i try to help
mrynit is offline   Reply With Quote