Problems
1) I need the names, ID, major to generate 50 different times.
2) I need to place the generated data on a Jtable. With inverted colors for the columns.
Also reason why i have "html" at the end if because im trying to put this table on a website. Any help is appreciated. Thanks.
public static void main(String[] args) {
// TODO code application logic here
String[] fnames = {"Mike","David","Jonathan","Peter","Paul","Nathan","Nicole","Eddie","Estelle","Emily","Joey","Aaron"};
String[] lnames = {"Eddy","Muggli","Defourneaux"};
//CODE which uses setup above to produce random name - use in loop
String randomFName;
randomFName = fnames[(int)(fnames.length*Math.random())];
String randomLName = lnames[(int)(lnames.length*Math.random())];
String randomName = randomFName + " " + randomLName;
//code produces random Customer ID - use in loop
String randomStudentID = ((int)(Math.random()*8999 + 1000)) + "";
//code produces random Customer ID - use in loop
String[] majors = {"Math","Actuarial Science","Computer Science","Information Technology"};
String randomMajor = majors[(int)(Math.random()*majors.length)];
System.out.println("<html>");
System.out.println(randomName);
//System.out.println(randomLName);
System.out.println(randomStudentID);
System.out.println(randomMajor);
System.out.println("</html>");
}
}

New Topic/Question
Reply



MultiQuote





|