Total members 10261 | Gratitudes |It is currently Wed May 23, 2012 9:19 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 5 posts ] 
Author Question
 Question subject: Need help with code for a while loop program
PostPosted: Fri Nov 19, 2010 4:49 am 
Offline
Newbie
User avatar

Joined: Sun Oct 31, 2010 8:04 pm
Posts: 2
Has thanked: 0 time
Have thanks: 0 time

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.


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Need help with code for a while loop program
PostPosted: Sun Nov 21, 2010 8:39 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2279
Location: Earth
Has thanked: 39 time
Have thanks: 61 time
hey brother,

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

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Need help with code for a while loop program
PostPosted: Sun Nov 28, 2010 2:24 am 
Offline
Newbie
User avatar

Joined: Sat Nov 27, 2010 1:06 am
Posts: 6
Has thanked: 2 time
Have thanks: 1 time
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.


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Need help with code for a while loop program
PostPosted: Sun Nov 28, 2010 3:25 am 
Offline
Newbie
User avatar

Joined: Sat Nov 27, 2010 1:06 am
Posts: 6
Has thanked: 2 time
Have thanks: 1 time
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.


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Need help with code for a while loop program
PostPosted: Sun Nov 28, 2010 3:36 am 
Offline
Newbie
User avatar

Joined: Sat Nov 27, 2010 1:06 am
Posts: 6
Has thanked: 2 time
Have thanks: 1 time
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.



For this message the author 3nriched has received gratitude : msi_333
TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 5 posts ] 
Quick reply


  

 Similar topics
 Read your gmail using Java code
 Code to open multiple links.
 I need help with checkers code
 I need you to help me to solve this program by c++ language
 java code for listing folder contents from remote folder
 code for online payment system in java
 apriori algorithm java code
 playfair cipher assembly code
 code
 How to write a JSP Program to manipulate Last Date visited

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




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