Total members 11119 |It is currently Sun May 19, 2013 11:16 am Login / Join Codemiles

All times are UTC [ DST ]



  Need help with code for a while loop program
Fri Nov 19, 2010 4:49 am 

I am not asking anyone to do my assignment for me, I just have no clue what I am suppose to do. I don't know where to start or what exactly the program is looking for. If someone would kindly explain or would help me out with this, I will definitely appreciate all the help I can get.

So my assignment is to write a program that used while loops to perform 6 different things.
1. prompt the users to input two integers: firstNum and secondNum (firstNum must be less than secondNum).
2. output all the odd numbers between firstNum and secondNum inclusive
3. output the sum of all the even numbers between firstNum and secondNum inclusive
4. output all the numbers and their squares between 1 and 10
5. output the sum of the squares of all the odd numbers between firstNum and secondNum inclusive
6. output all the uppercase letter.
and lastly there is a hint: if currentNum % 2 = 0, then the currentNum is an even number. Otherwise it is an odd number.

Once again, I am not expecting or asking anyone to do a whole code or my entire assignment for me. I just really need help because I am so confused with the whole program. Thank You.


Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time
TOP
   
 
  Re: Need help with code for a while loop program
Sun Nov 21, 2010 8:39 pm 
hey brother,

Try to write some code and come so we help you in it ,!!!

_________________
Please recommend / share my post if you found it helpful.


Author:
Mastermind
User avatar Posts: 2783
Have thanks: 71 time
TOP
   
 
  Re: Need help with code for a while loop program
Sun Nov 28, 2010 2:24 am 
1) for(onecounter = 1;onecounter <= 3; onecounter++)
{
System.out.println("Enter Number " + onecounter + " : ");
}

_________________
Environmental enrichment (neural), how the brain is affected by the stimulation of its information processing provided by its surroundings.


Author:
Newbie
User avatar Posts: 6
Have thanks: 1 time
TOP
   
 
  Re: Need help with code for a while loop program
Sun Nov 28, 2010 3:25 am 
hehe

im gonna try this just for funnzies..:)

_________________
Environmental enrichment (neural), how the brain is affected by the stimulation of its information processing provided by its surroundings.


Author:
Newbie
User avatar Posts: 6
Have thanks: 1 time
TOP
   
 
  Re: Need help with code for a while loop program
Sun Nov 28, 2010 3:36 am 
this is wut i got atm,maybe others can input as a grp assignment :p


Code:
 
import java
.util.Scanner//import scanner class

 
class loopsforumhelp
 
{
 
    public static 
void main(String[] args)
    {
 
 
   
int NumOne 0;  //inputted number one
   
int NumTwo 0;  //inputted number two

   
Scanner keyboard = new Scanner(System.in);  // holds input

        
        
           
for(int onecounter 1;onecounter <= 2onecounter++)
           {
             if(
onecounter == 1)
             {
                
System.out.println("Lowest Number First.");
                
System.out.println("Enter Number " onecounter " : ");
                    
NumOne keyboard.nextInt();
             }
             if(
onecounter == 2)
             {
                
System.out.println("Enter Number " onecounter " : ");
                    
NumTwo keyboard.nextInt();
             }
            }
            
        for(
int twocounter NumOne;twocounter <= NumTwo;twocounter+2;)
        {
                
System.out.println(twocounter);
        }        

 
}
}
 

_________________
Environmental enrichment (neural), how the brain is affected by the stimulation of its information processing provided by its surroundings.


Author:
Newbie
User avatar Posts: 6
Have thanks: 1 time

For this message the author 3nriched has received gratitude : msi_333
TOP
   
 
Post new topic Reply to topic  [ 5 posts ] 

  Related Posts  to : Need help with code for a while loop program
 java loop at end of code ... soooo close i hope     -  
 do while loop and for loop C++ example help.     -  
 Do while loop     -  
 C++ While loop     -  
 Need help with a loop     -  
 While loop     -  
 PIC Assembly For Loop Example     -  
 Breaking a Loop     -  
 Why will my loop does not work     -  
 I NEED SOME HELP IN THE FOR LOOP PLZ .. IAM JUST A BEGINNER     -  

All times are UTC [ DST ]



Jump to:  




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team