Question
Write an abstract superclass encapsulating or for a Vacation: A vacation has two attributes, budget and destination. It has an abstract method returning how much
Write an abstract superclass encapsulating or for a Vacation: A vacation has two attributes, budget and destination. It has an abstract method returning how much the vacation is over budget. Create two non-abstract classes that extend vacation: one for an all-inclusive vacation, and another for a piecemeal vacation. All inclusive will have three attributes: brand, rating (represented by number of stars), and a price. Piecemeal needs to have a list of items (hotel, meals, airfaire, etc.) and their corresponding costs. This can be handled using parallel arrays, thus there will only be two attributes. Be sure to write appropriate getters, setters, and constructors for all 3 classes. Don't forget the abstract method. HINT: It is ok to have a constructor for an abstract class. It can be called to set up attribute values from the child class. Write a test application for these classes. You can create this as an application for a user to determine which vacation option is right for them. Create a piecemeal and all inclusive vacation object. Be sure to appropriately ask for and load the field values. Display all information for each object and display whether the vacation is over budget (showing by how much), under budget (showing how much), or right at budget.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started