This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hello again. New homework assignment.... User is prompted one at a time to enter in the following; -arrival month (1-12) -arrival day (1-31) -arrival year -departure month (1-12) -departure day (1-31) -departure year (assume valid data)
application displays arrival date, departure date, daily rate (a constant of $115.00), total price and number of nights.
�Create a class that defines a reservation. This class should contain instance variables for the arrival date, departure date, number of nights, and total price. It should also contain a constant initialized to the nightly rate of $115.00. �This class should contain at least two constructors: a default one and one that accepts the arrival date and departure date. Within this constructor, the number of nights and total price should be set. This means that this class should contain two methods that set both these instance variables. This class should also override the toString method. �Create a driver class that gets the user input, creates a reservation object, and displays it in a dialog box.
If I were to breakdown what needs to be done;
-User inputs data
-App calculates # of nights based on user data
-App calculates total price
-App displays results
My first road block is- how do I go about calculating # of nights?
Would this get done in a separate class (GregorianCalendar?) file or could I do this in the driver class?