point me in the right direction, would be very helpful--Java-HELP PLEASE
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: point me in the right direction, would be very helpful--Java-HELP PLEASE

Threaded View

  1. #1
    Join Date
    Jan 2013
    Posts
    20

    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 05: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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center