Ch. 4,5,6,7,10,11 Mar. 28, 2000 1. Where is a method variable declared? and where can it be used? 2. Where is an instance variable declared? and where can it be used? 3. How would you declare and allocate an array of 5 Buttons? 4. Evaluate each: Math.floor(7.689) 100 * Math.random( ) // give range Math.pow(3, 4) 5. How would you declare and instantiate an array of 4 Strings with values "Yesterday", "Today", "Tomorrow", "Always"? 6. The Puppy class contains 3 constructors. What are their names? 7. Name 3 instance variables that you'd expect the Puppy class to have. 8. Name 3 methods that you'd expect the Puppy class to have. Questions 9 - 14 use the information below. class Person has these instance variables private String firstName; private String lastName; private int age; private char gender; private String employer; private boolean vacationing; and these methods public Person( String fName, String lName, int a, char gen ) public String toString( ) public void setFirstName( String firstN ) public void setLastName( String lastN ) public void setAge( int a ) public void setEmployer( String emp ) public void setVacationing( boolean vac ) public String getFirstName( ) public String getLastName( ) public int getAge( ) public char getGender( ) public String getEmployer( ) public boolean getVacationing( ) public void makeOneYearOlder( ) 9. Write a statement that declares joe to be an instance of the Person class. 10. Write a statement that instantiates joe as a 30 year old male with name Joe Doe. 11. Write a statment that writes "Where did you go?" on the DOS screen if joe is on vacation. 12. Write a statement that adds one year to joe's age. 13. Write a statement that makes joe's employer be "CCBC". 14. Write a statement that changes joe's first name to "Joseph". 15. You want to create a subclass of the Person class called Student. It will have instance variables called school, gpa, major, and creditsEarned. What types should these instance variables have? 16. What are the names of 4 get-methods that you should define? Give the definition for one of them. 17. What are the names of 4 set-methods that you should define? Give the definition for one of them. Questions 18-22 use Choice button (pull-down list). 18. Declare a Choice button (pull-down list) called yearChoice to be used in an applet. 19. Add these 5 items to yearChoice: 2000, 2001, 2002, 2003, 2004 20. What statement says your applet is an event listener for yearChoice? 21. Place yearChoice on the applet. 22. To process events from yearChoice, what method must you define? For 23-24. Your source code contains the line public class Quiz extends Applet implements ItemListener { 23. What is the subclass? What is the interface? 24. Due to "implements ItemListener" what method must class Quiz provide? 25. What is the default layout manager called? What is another layout manager called?