//Make three sets of words to give Freshmen advice //Adapted from Head First Java by Kathy Sierra //GUI by Jan Goddard import javax.swing.*; public class AdviceToFreshman2{ //Make three sets of words to choose from //Adapted from Head First Java by Kathy Sierra public String createAdvice(){ String[] adviceListOne = {"Ask for directions to class from", "Reveal the name of your secret love to", "Buy your supplies from", "Make friends with", "Learn good study habits from", "Get school spirit from", "Ride the bus with", "Eat lunch with", "Say hello to", "Cheer for the"}; String[] adviceListTwo = {"the Principal", "your best friend", "your PE teacher", "your counselor", "the cafeteria lady", "the librarian","the computer geek", "the school resource officer", "the president of the Chess Club", "the captain of the basketball team"}; String[] adviceListThree = {"in the cafeteria", "in the hallway", "in the restroom", "in the gym", "during a football game", "in the school store", "in the parking lot", "in Spanish class", "at the Homecoming Dance"}; //Count the number of words in each list int oneCount = adviceListOne.length; int twoCount = adviceListTwo.length; int threeCount = adviceListThree.length; //generate 3 random numbers int rand1 = (int) (Math.random() * oneCount); int rand2 = (int) (Math.random() * twoCount); int rand3 = (int) (Math.random() * threeCount); //Build some advice String advice = adviceListOne[rand1] + " " + adviceListTwo[rand2] + " " + adviceListThree[rand3]; //print out advice return advice; } } //END OF CLASS