Question
please Write C# program and thank you: This assignment has four parts: 1. Write an abstract Vacation class. 2. Write two subclasses that inherit from
please Write C# program and thank you:
This assignment has four parts:
1. Write an abstract Vacation class.
2. Write two subclasses that inherit from Vacation, All-InclusiveVacation and PiecemealVacation.
3. Write a program that creates one All-InclusiveVacation object and one PiecemealVacation object.
Task 1 The Vacation Abstract Class First, let us make a simple abstract class titled Vacation. A Vacation should include: a budget attribute and a destination attribute, a ToString method that returns both of the class variables AND the name of the class (which should be Vacation). There should also be an abstract Budget method, which will be implemented in the subclasses to determine if the vacation was over or under budget. It SHOULD NOT include any type of constructor. The variables should be made protected, but the methods should be public.
Task 2 The All-InclusiveVacation and PiecemealVacation subclasses Create two classes that both inherit from the Vacation class. The All-InclusiveVacation should include the class variables brand, rating, and price, as well as an overloaded constructor that sets these variables and a ToString method that prints out all of its variables. NOTE: Remember that it also has the variables from Vacation, which will need to be printed out too. The brand will represent the agency that you booked the vacation through such as ClubMed or Delta Vacations. The rating will be the star number for the particular vacation being taken, between zero (0) and five (5) stars. The price should be the cost for the entire vacation and any services used during it (including flights, rooms, etc. since it is all inclusive) so the price should be at least $1,000. For the PiecemealVacation, please include two array variables one to hold a set of items that will be bought for the vacation and the other to hold the costs of each of those items. Also include an overloaded constructor that sets all its variables and a ToString to print them all out. The set of items should at least include the hotel, all of the meals, and a round trip flight to the location. In the same order, the set of costs should at least include the cost of the hotel, all of the meals (we did the math before going on vacation), and the cost for a round trip flight to the location. For both classes, please implement the Budget method so that it takes the cost of the vacation and determines how much that was over or under the vacations budget variable. For the All-InclusiveVacation this should use the price variable and for the PiecemealVacation it should use the set of costs.
Task 4 The Driver (Main Program) Now create an instance of both the All-InclusiveVacation and PiecemealVacation. Allow the user to input values for each of the two (2) instances. For the PiecemealVacation instance after each item and their associated cost is added to the vacation, ask the user if they would like to stop entering items. Finally, print out the data stored in each object using their ToString methods and print out each of their results for the Budget method (DO NOT explicitly call the ToString method when doing so). Below is some possible sample output (note: simply means, there exists):
Some Sample Output: Please enter All-Inclusive Vacations budget: 4000 Please enter All-Inclusive Vacations destination: Bahamas Please enter All-Inclusive Vacations brand: Sandals Please enter All-Inclusive Vacations rating: 5 Please enter All-Inclusive Vacations price: 5000 The budget is $4000, the destination is Bahamas, the brand is Sandals, the rating is 5 stars, and the price is $5000. This vacation was $1000 over budget. Please enter PiecemealVacation Vacations budget: 3000 Please enter PiecemealVacations destination: Cayman Islands Please enter PiecemealVacations items: Hotel Please enter Hotel cost: 1000 Have you finished entering all items? No Please enter PiecemealVacations items: Meals Please enter Meals cost: 300 Have you finished entering all items? No Please enter PiecemealVacations items: Flight Please enter Flight cost: 500 Have you finished entering all items? Yes The budget is $3000, the destination is Bahamas, and the items needed for the vacation are: a Hotel that costs $500, a Meals that costs $200, and a Flight that costs $500. This vacation was $1200 under 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