Created
October 18, 2013 16:50
-
-
Save imryan/7044368 to your computer and use it in GitHub Desktop.
Username generator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Usernames { | |
| public static void main(String[] args) { | |
| // Declare variables | |
| Scanner sc = new Scanner(System.in); | |
| String first, last, username; | |
| // Get input | |
| first = sc.next(); | |
| last = sc.next(); | |
| // Create random generator | |
| Random generator = new Random(); | |
| int randomNumber = generator.nextInt(90) + 10; | |
| // Generate username | |
| username = first.charAt(0) + last.substring(0, 5) + randomNumber; | |
| System.out.println(username); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fghd