-
January 20th, 2013, 06:42 PM
#1
point me in the right direction, would be very helpful--Java-HELP PLEASE
Hello to all the Java Gurus....Please help!
I am very close to completing this assignment and I can not figure out what I am doing wrong. The output is suppose to be my 3 initials(Capitalized) and then a 2 digit random number after the initials. my output is giving me 2 digits after each initial. Can some one please help me. OUTPUT is suppose to look like this......DES34.
import java.util.Random;
import java.util.Scanner;
import java.lang.String;
public class UserID
{
public static void main(String args[]) {
Scanner login = new Scanner(System.in);
System.out.println("Enter your full Name: ");
String Fullname = login.nextLine();
Fullname = (Fullname).toUpperCase();
String[] splits = Fullname.split(" ");
for(String Fname: splits){;
char Finame = Fname.charAt(0);
char endname = Finame;
Random r = new Random();
String userid = "";
for (int i = 10; i < 90;++i){
int rand = r.nextInt(1) + 90;
userid = String.valueOf(rand);}
String User = ("" + endname + userid);
System.out.print(User);
}
}
}
Output:
Enter your full Name:
dan eben stevens
D90E90S90
Last edited by dstevens; January 20th, 2013 at 06:43 PM.
Reason: Misspelling
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|