EVERYTHING HAS TO BE DONE IN C#.
(I need pseudocode and source code please)
Problem Statement:
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:
Piecemeal Vacation:
Lastly, create a test class that will create 2 All-Inclusive Vacation and 2 Piecemeal Vacation object inside of the 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.
// C# program to show the
// working of abstract class
using System;
// abstract class 'Vacation'
public abstract class Vacation {
double cost,budget,destination;
// abstract method 'KeptToBudget()'
public abstract void KeptToBudget();
//returns how much the vacation is over or under budget using cost.
}
// class 'Vacation' inherit
// in child class 'AllInclusiveVacation'
public class AllInclusiveVacation: : Vacation
{
string brand;// such as ClubMed, Delta Vacations, etc..
string rating;// such as number of stars
string totalcost;//all-inclusive means that there is one price for all expenses on the trip).
}
public class PiecemealVacation : Vacation
{
List<int> expenses = new List<int>();//such as hotel, meal, airfare, etc.
List<int> correspondingCosts = new List<int>();//such as hotel cost, meal cost, airfare cost, etc.
}
Get Answers For Free
Most questions answered within 1 hours.