Question

EVERYTHING HAS TO BE DONE IN C#. (I need pseudocode and source code please) Problem Statement:...

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:

  • 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 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.

Homework Answers

Answer #1

// 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.

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT