Question: JAVA: Write an abstract class encapsulating data for a Vacation. A vacation has two attributes: a budget and a destination NOTE -- there are extra
JAVA: Write an abstract class encapsulating data for a Vacation. A vacation has two attributes: a budget and a destination
NOTE -- there are extra commas in the data file for items that do not belong to that particular vacation. You should ignore these. But, you need to determine how you will decide which type of vacation you are reading. I have included a "code" as the first token on the line, a for all-inclusive vacations, p for piecemeal.
In addition to the "typical behaviors", each subclass has the ability to report on how much the vacation is over or under the budget (this is the abstract method in Vacation).
The Vacation class has two sub classes: an all-inclusive vacation and a piecemeal vacation (each of the pieces of the vacation are bought separately i.e. airfare, hotel, car, etc.). The all-inclusive vacation has three additional attributes: a brand (like VacationExpress), a rating (an integer representing the number of stars) and a price. The piecemeal vacation has two additional attributes: an array representing the pieces (airfare, hotel, car) and a second array representing the corresponding prices for each).
Create a VacationUtilities class that will create an ArrayList of Vacation objects and contain methods as listed below in the menu.
Your driver will (by menu choice):
>Call the method to display all all-inclusive vacations
>Call the method to display all piecemeal vacations
>Call the method to display all vacations that are under budget
>Call the method to display all vacations that are over budget
>Call the method to display the average budget for all vacations in the database.
Deliverables:
VacationDriver.java -- the class with main()
Vacation.java
AllInclusiveVacation.java
PiecemealVacation.java
VacationUtilities.java
vacationData.csv
_________________________________________________
vacationData.csv
code,vacation destination,budget,brand,rating,price,airfare,hotel,car a,Cozumel Mexico,1250,Vacation Express,4,1109,,, a,Antigua,1750,Cheap Caribbean,3.5,1510,,, a,Cancun Mexico,1000,bookit,4,789,,, a,Costa Rica,2500,CostCo Travel,5,2799.55,,, p,Paris France,1750,,,,640,1308,126 p,Orlanda Florida USA,1500,,,,158,1152,154 p,Solta Croatia,1250,,,,1222,264,54 p,Banff Alberta Canada,1750,,,,449,1104,259
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
