I am having trouble figuring out the programming logic.How do you get the array of strings to print asteriks at random indexes. Note that the 3 is the number of asterisk to be generated in the array.
so the output can be [a,b*,c*,d,e*,f,g,h] or [a*,b,c,d,e,f,g*,h*]
public class Generate
{
public static void main(String[] args)
{
String[] list = {"a","b","c","d","e","f","g","h"};
for(int i =0; i <list.length; i++)
{
System.out.print(" " + list[i]);
generateAsterisk(list);
}
System.out.println();
}
public static void generateAsterisk(String[] list)
{
for(int i = 0; i < 3; i++)
{
int index = (int)(Math.random()*i);
}
System.out.print("*");
}
}