Question: Java Build an application that handles setting up vacation plans. Create an abstract superclass called Vacation Instance Variables destination - String budget - double Constructors
- Java
- Build an application that handles setting up vacation plans.
- Create an abstract superclass called Vacation
- Instance Variables
- destination - String
- budget - double
- Constructors - default and parameterized to set all instance variables
- Access and mutator methods
- budgetBalance method - abstract method that returns the amount the vacation is under or over budget. Under budget is a positive number and over budget is a negative number.
- Instance Variables
- Create a concrete class called AllInclusive that is a subclass of Vacation and represents an all inclusive vacation like Sandals or Club Med.
- Instance Variables
- brand - String, such as Sandals , Club Med etc
- rating - int, representing number of stars such as 5 star rating.
- price - double, the total cost of the vacation
- Constructor - default and parameterized to set all instance variables
- Accessor and mutator methods
- Overwritten budgetBalance method.
- Instance Variables
- Create a concrete class called ALaCarte that is a subclass of Vacation and represents a vacation that requires payment for each activity separately
- Instance Variables
-
- hotelName - String
- roomCost - double
- airline - String
- airfare - double
- meals - double - estimated total meal expenses.
- Constructor - default and parameterized to set all instance variables
- Accessor and mutator methods
- Overwritten budgetBalance method.
- Create JUnit Tests
- Create JUnit Tests to test the budgetBalance methods in both the AllInclusive and ALaCarte classes.
- Test each method from polymorphically via an object variable that is of type Vacation.
- Review the JUnit API and documentation as since the budgetBalance method returns a double, you will need to use one of the assertEquals methods that handles doubles since doubles values may not be exact due to rounding errors.
- Create a VacationTester class
- Test all methods.
- Create at least 2 object of each Vacation subclass
- Place those object in an array of type Vacation.
- Loop through the array and polymorphically call the budgetBalance and display the results.
**********************Sample run with some additional output****************
Your trip to , a 0 star resort at , will cost $0.0. Your budget for this trip was $0.00. *The vacation is within your budget. the balance remaining is: $0.00.
Your trip to resort at will cost $0.0 not including meals, which will cost an additional $0.0. You will arrive via which will cost an additional $0.0. Your budget for this trip was $0.0. *The vacation is within your budget. the balance remaining is: $0.00.
Your trip to Club Med, a 5 star resort at The Bahamas, will cost $1499.99. Your budget for this trip was $2000.00. *The vacation is within your budget. the balance remaining is: $500.01.
Your trip to Hilton, Oahu resort at Hawaii will cost $450.99 not including meals, which will cost an additional $400.34. You will arrive via Delta Airlines which will cost an additional $1300.57. Your budget for this trip was $2000.0. *The vacation is not within your budget. the balance remaining is: $-151.90.
Your trip to Carnival, a 5 star resort at The Bahamas, will cost $3456.99. Your budget for this trip was $3000.00. *The vacation is not within your budget. the balance remaining is: $-456.99.
Your trip to Ritz Carlson, New York resort at New York will cost $350.99 not including meals, which will cost an additional $569.34. You will arrive via Unitied Airlines which will cost an additional $1200.78. Your budget for this trip was $5000.0. *The vacation is within your budget. the balance remaining is: $2878.89.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
