Write an abstract class called Vacation that includes three class variables named: cost, budget and destination. It has an abstract method, KeptToBudget, returning how much the vacation is over or under budget using cost.

This class has two non-abstract subclasses, each with their own class variables:

All-Inclusive Vacation:

  • brand (such as ClubMed, Delta Vacations, etc.)
  • rating (number of stars)
  • total cost (all-inclusive means that there is one price for all expenses on the trip).

Piecemeal Vacation:

  • list of expenses (hotel, meal, airfare, etc.).
  • list of corresponding costs (hotel cost, meal cost, airfare cost, etc.).

(Both of these class variables must be an array, or similar data structure.)

Lastly, create a test class that will create 2 All-Inclusive Vacation and 2 Piecemeal Vacation object inside of a main method. Also create 2 Vacation objects that are set to 1 All-Inclusive Vacation and 1 Piecemeal Vacation object. You may have user input for their object variables or you may hardcode the values. Ensure that you print each object's values to the console along with the return value of the KeptToBudget method.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.