Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 18th, 2008, 8:56 PM   #1
kewlgeye
Programmer
 
Join Date: Jan 2008
Posts: 54
Rep Power: 1 kewlgeye is on a distinguished road
Value-returning methods with and without a parameter

How do I do this?

Combine into one program 2 different created loops with 2 distinct methods.

1.) one value returning method with a parameter and
2.) one void method without a parameter

I have two of my loop programs that I created last week. But I don't know how to modify them or combine them to do what I asked above. How can I do this. These are my loops.

BREAK LOOP

java Syntax (Toggle Plain Text)
  1. import java.util.*;
  2.  
  3. public class loop
  4. {
  5.  
  6. public static void main (String[] args){
  7.  
  8. for(int i = 30; i > 0; i--)
  9. {
  10. if(i == 27)
  11. continue;
  12. else if(i < 5)
  13. break;
  14. else
  15. System.out.println(i);
  16. }
  17. }
  18. }


and a DO-WHILE LOOP

java Syntax (Toggle Plain Text)
  1. import java.util.*;
  2.  
  3. public class loop
  4. {
  5.  
  6. public static void main (String[] args){
  7.  
  8. int loopcount = 31;
  9. do
  10. {
  11. loopcount--;
  12. if(loopcount == 27)
  13. continue;
  14. System.out.print(loopcount + " ");
  15. }
  16.  
  17. while (loopcount > 5);
  18.  
  19. }
  20. }

I don't understand how to do this, could someone tell me how?
kewlgeye is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC