Hi I currently have to develop a application for my basic level java programming class, that takes a first, last and middle name entered. Then takes the first letter from first name, and middle name, and the first 4 letters of last name, and then adds a random generated number from 100-999 for a username.
For example:
If I entered: Raymond Jason Smith
It would return: RJSmit222
I need help on making all my generated username display in lowercase only, no matter if user enters it in uppercase
import java.util.Random; import java.util.Scanner; public class random { public static void main (String[] args) { Scanner scan = new Scanner(System.in); Random random = new Random(); String first; String middle; String last; System.out.print ("First name? "); //prompts user for first name first = scan.nextLine (); System.out.print ("Middle name? "); //prompts user for middle name middle = scan.nextLine (); System.out.print ("Last name? "); //prompts user for last name last = scan.nextLine (); System.out.println ("\nInputed first name was: " + first); //tells user inputed data - first name System.out.println ("Inputed middle name was: " + middle);//tells user inputed data - middle name System.out.println ("Inputed last name was: " + middle); //tells user inputed data - last name int randomNumber = random.nextInt(899) + 100; //random generated number from 100-999 for username System.out.println ("Random computer generated number: " + randomNumber); //Tells user the generated number System.out.print ("\nYour generated username is: " + first.charAt(0) + middle.charAt(0) + last.substring (0, 4) + randomNumber); //echo generated username } }