I am writing a basic program that asks the user for the length of a data set, and then lets them manually fill it in in order. I am writing the code so the only input parameter is a string representing what they want to name the array they are creating, but I'm having trouble converting the input string into a variable I can use to name the array.
public static void createArray(String n)
{
int[] a = new int[(int)myFunctions.getValue("How long do you want your integer array?")];
for(int i = 0; i < a.length; i++)
{
a[i] = (int)myFunctions.getValue("Enter term " + i + " of your integer array");
}
}
Right now I am using 'a' as a placeholder name, but ideally I'd lake variable 'a' to be what the input string 'n' was. Would I have to parse the string to be an integer array?
(note, myFunctions.getValue() just asks the user for an integer input)