Create a housing application for a property manager. Include a base class named
ID: 3855851 • Letter: C
Question
Create a housing application for a property manager. Include a base class named Housing. Include data characteristics such as address and year built. Include a virtual method that returns the total projected rental amount. Define an interface named IUnits that has a method that returns the number of units. The MultiUnit class should implement this interface. Create subclasses of MultiUnit and SingleFamily. SingleFamily should include chracteristics such as size in square feet and availability of garage. MultiUnit might include characteristics such as the number of units. Create .DLL components for the housing classes. Define a presentation class to test your design.
i need a copiable source code.
Explanation / Answer
Housing.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chapter_11.Exercises.Ex10
{
class Housing
{
public string Address { get; set; }
public int YearBuilt { get; set; }
public virtual decimal RentAmount()
{
return 0;
}
public Housing(string address = "unavailable", int year = 1998)
{
Address = address;
YearBuilt = year;
}
}
}
SingleFamily.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chapter_11.Exercises.Ex10
{
class SingleFamily : Housing
{
public double SquareFeet { get; set; }
public bool Garage { get; set; }
public SingleFamily(decimal cost = 0, string address = "unavailable", int year = 1998, double feet = 0, bool garage = false)
: base(address, year)
{
SquareFeet = feet;
Garage = garage;
amount = cost;
}
private decimal amount = 0;
public override decimal RentAmount()
{
// Logic
return amount;
}
}
}
IUnits.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chapter_11.Exercises.Ex10
{
interface IUnits
{
int NumberOfUnits();
}
}
MultiUnit.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chapter_11.Exercises.Ex10
{
class MultiUnit : Housing, IUnits
{
private int numberOfUnits = 0;
public int NumberOfUnits()
{
return numberOfUnits;
}
public MultiUnit(decimal cost, string address, int year, int units)
: base(address, year)
{
amount = cost;
numberOfUnits = units;
}
private decimal amount = 0;
public override decimal RentAmount()
{
// Logic
return amount;
}
}
}
Presentation.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chapter_11.Exercises.Ex10
{
static class Presentation
{
static MultiUnit multi = new MultiUnit(1200, "421 Yarn Drive", 2002, 10);
static SingleFamily single = new SingleFamily(2200, "9392 Tree Trail", 1996, 1250, true);
static public string MultiUnit()
{
return string.Format(
"Address: {0} " +
"Year Built: {1} " +
"Units Available: {2} " +
"Price: {3:C} ",
multi.Address, multi.YearBuilt, multi.NumberOfUnits(), multi.RentAmount()
);
}
static public string SingleFamily()
{
return string.Format(
"Address: {0} " +
"Year Built: {1} " +
"Square Feet: {2:N} " +
"Garage: {3} " +
"Price: {4:C} ",
single.Address, single.YearBuilt, single.SquareFeet, single.Garage, single.RentAmount()
);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.