this is my code....and problem I need to have an input from user where the first letter is used , then from the second user input from 0 to 5 the characters are used, and finally generate a random number....I have tried everything for the second portion (0 to 5 characters) and I've searched the internet for different answers but nothing works.
here is the source code :
//********************************************************************
// NameNumberConverter.java Java Foundations
//
//
//********************************************************************
import java.lang.*;
import java.util.Scanner;
import java.util.*;
public class NameNumberConverter
{
//-----------------------------------------------------------------
// First the user inputs their first and last names
//-----------------------------------------------------------------
public static void main(String[] args)
{
Scanner sc = new Scanner( System.in );
System.out.println ("Please insert your first name : ");
String Firstname=sc.next();
System.out.println ("Please insert your last name : ");
String Lastname=sc.next();
char end = Firstname.charAt(0);
char end2 = Lastname.charAt(0, 5);
System.out.println ("The converted result is: " + end + end2);
sc.close();
}
}
Thanks for anything that can be helpful. as I am a student and definitely not a pro....