CPE 101, Spring 2003 C.S. Turner Suggestions for study: a. All notes and slides should be rewritten and summarized. b. Overall book emphasis would be 1.1 - 1.5, 2.1 - 2.9, 3.1 - 3.5, 3.7 (part of 3.6), 4.1 - 4.3, 4.6. c. I suggest you study the "Chapter Review" for each chapter carefully. d. I suggest you review the "Common Errors and Debugging" sections for Chapter 2, 3, and 4. e. I suggest you do the "Quick Check Exercises" and "Review Exercises" for Chapter 2 and 3. f. I suggest you do the "Quick Check Exercises" for Chapter 4 (skip 3, 9 11 and 12). Do Chapter 4 "Review Questions" (skip 7 and 8). For the practice exam questions, work over my example from the Summer of 2001 first. Add these: 9. Consider this partial class declaration: public class Birthdate { private int month; private int day; private int year; } a) write an appropriate constructor of this class to initialize the instance variables. b) write a statement to instanitate an object of this class using your birthdate (or some other birthdate) as the arguments. The new object should be referenced by the identifier myBDay c) write an accessor method for this class d) write a statement, using myBDay, to call your accessor method e) write one mutator method for this class f) using myBDay, write a statement that calls your constructor 10. Write a program that calculates the cost of an automobile trip given the distance traveled, the model of your car and its EPA mileage rating in miles/gallon. You must design an application class, TripCost, to handle user input and output. You must design a worker class called Automobile to keep info about the car and do the necessary calculations. Your application class will use JOptionPane to prompt the user for the make of the automobile (example "2001 Toyota Echo"). It will then prompt for the EPA mileage rating (in miles/gallon). You will then create an automobile object and assign the reference to a variable called aCar. The object will hold both pieces of information (make of the automobile and EPA rating) in two private instance variables. Your worker class should also hold a private static constant that holds the current price of a gallon of gas (make it $2.10). Your worker class will have a constructor, accessors and mutators for the instance variables, and a method called milesToTravel that requires one parameter and returns the cost of the trip. You will have your program prompt the user for the distance of the trip and print a message that tells the user how much the trip will cost. 11. Tell me if the following statements are valid, and if they are valid, what is their value? int i = 1/5; boolean import = false; double d = 6; 12. What is the value of x after executing the following? a) x = 7 + 3 * 1 / 2 - 1; b) x = 2 % 2 + 2 * 2 - 2 / 2; c) x = (3 * 9 * ( 3 + 9 + 3 / (3)));