This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Simple program problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple program problem" Watch "Simple program problem" New topic
Author

Simple program problem

Phil Castles
Greenhorn

Joined: Mar 08, 2009
Posts: 2
Hi guys, having abit of trouble getting the login box goin. Could you please provide me with correct code for the below?

I need to:

prompt for and input user name
prompt for and input user number
while the user number is not between 1 and 500 inclusive
warn the user the number is not in the correct range
prompt for and input user number
set identifier to first letter of username, followed by hyphen, followed by user number
write out the user name
write out user number
write out identifier

Many Thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37941
    
  22
Welcome to JavaRanch

We don't supply "answers" like that, but you are obviously half-way there, so please show us what you have got so far, and we shall be happy to discuss it.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

You already wrote the pseudo-code, so all you need to do is translate each line to actual code. Console (since Java 6) and Scanner (since Java 5.0) can help you out a lot.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Phil Castles
Greenhorn

Joined: Mar 08, 2009
Posts: 2
It's the actual code that im having issues with. im just trying to create this for my business but am failing miserably.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Then show us what you've got, like Campbell asked.
 
 
subject: Simple program problem
 
Similar Threads
How to compare String and int?
How to take input from screen automatically
Identifier expected
overriding
regular expression