diff --git a/cis237assignment3/Droid.cs b/cis237assignment3/Droid.cs new file mode 100644 index 0000000000000000000000000000000000000000..c4b9feea5e2aa6d530c47e58256319a28335ed54 --- /dev/null +++ b/cis237assignment3/Droid.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cis237assignment3 +{ + /// <summary> + /// Abstract class for Droids. + /// Derives from IDroid interface. + /// </summary> + abstract class Droid : IDroid + { + #region Variables + + public string materialString; + public string modelString; + public string colorString; + public decimal baseCostDecimal; + public decimal totalCostDecimal; + + #endregion + + + + #region Constructor + + /// <summary> + /// Base constructor. + /// </summary> + public Droid() + { + + } + + /// <summary> + /// + /// </summary> + /// <param name="material"></param> + /// <param name="model"></param> + /// <param name="color"></param> + public Droid(string material, string model, string color) + { + Material = material; + Model = model; + Color = color; + + baseCostDecimal = 10m; + } + + #endregion + + + + #region Properties + + public string Material + { + set { materialString = value; } + get { return materialString; } + } + + public string Model + { + set { modelString = value; } + get { return modelString; } + } + + public string Color + { + set { colorString = value; } + get { return colorString; } + } + + public decimal BaseCost + { + set { baseCostDecimal = value; } + get { return baseCostDecimal; } + } + + public decimal TotalCost + { + set { totalCostDecimal = value; } + get { return totalCostDecimal; } + } + + #endregion + + + + #region Methods + + public abstract void CalculateTotalCost(); + + public virtual string DisplayToString() + { + return materialString + " " + modelString + " : " + colorString; + } + + #endregion + + } +} diff --git a/cis237assignment3/DroidCollection.cs b/cis237assignment3/DroidCollection.cs new file mode 100644 index 0000000000000000000000000000000000000000..d723924de840bdd8efec6142abdd030f44db957d --- /dev/null +++ b/cis237assignment3/DroidCollection.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cis237assignment3 +{ + static class DroidCollection + { + #region Variables + + + + #endregion + + + + #region Constructor + + + + #endregion + + + + #region Properties + + + + #endregion + + + + #region Methods + + + + #endregion + + } +} diff --git a/cis237assignment3/Droid_Astromech.cs b/cis237assignment3/Droid_Astromech.cs new file mode 100644 index 0000000000000000000000000000000000000000..8274f2f95ea43a580e339e567c200af0d5a3c70d --- /dev/null +++ b/cis237assignment3/Droid_Astromech.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cis237assignment3 +{ + /// <summary> + /// Class for Droids of type Astromech. + /// Inherits from Utility which inherits from Droid. + /// </summary> + class Droid_Astromech : Droid_Utility + { + #region Variables + + protected bool hasFireExtinguisherBool; + protected int numberOfShipsInt; + + #endregion + + + + #region Constructor + + /// <summary> + /// Base constructor. + /// </summary> + public Droid_Astromech() + { + + } + + /// <summary> + /// + /// </summary> + /// <param name="material"></param> + /// <param name="model"></param> + /// <param name="color"></param> + /// <param name="hasToolBox"></param> + /// <param name="hasComputerConnection"></param> + /// <param name="hasArm"></param> + /// <param name="hasFireExtinguisher"></param> + /// <param name="numberOfShips"></param> + public Droid_Astromech(string material, string model, string color, bool hasToolBox, bool hasComputerConnection, bool hasArm, bool hasFireExtinguisher, int numberOfShips) + : base(material, model, color, hasToolBox, hasComputerConnection, hasArm) + { + HasFireExtinguisher = hasFireExtinguisher; + NumberOfShips = numberOfShips; + } + + #endregion + + + + #region Properties + + public bool HasFireExtinguisher + { + set { hasFireExtinguisherBool = value; } + get { return hasFireExtinguisherBool; } + } + + public int NumberOfShips + { + set { numberOfShipsInt = value; } + get { return numberOfShipsInt; } + } + + #endregion + + + + #region Methods + + public override void CalculateTotalCost() + { + base.CalculateTotalCost(); + } + + public override string DisplayToString() + { + return base.DisplayToString() + Environment.NewLine + + "Fire Extinguisher: " + YesNoString(hasFireExtinguisherBool) + Environment.NewLine; + } + + #endregion + + } +} diff --git a/cis237assignment3/Droid_Janitor.cs b/cis237assignment3/Droid_Janitor.cs new file mode 100644 index 0000000000000000000000000000000000000000..daca26d70ab55567684ab9e634c85ec304787458 --- /dev/null +++ b/cis237assignment3/Droid_Janitor.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cis237assignment3 +{ + /// <summary> + /// Class for Droids of type Janitor. + /// Inherits from Utility which inherits from Droid. + /// </summary> + class Droid_Janitor : Droid_Utility + { + #region Variables + + protected bool hasTrashCompactorBool; + protected bool hasVacuumBool; + + #endregion + + + + #region Constructor + + /// <summary> + /// Base constructor. + /// </summary> + public Droid_Janitor() + { + + } + + /// <summary> + /// + /// </summary> + /// <param name="material"></param> + /// <param name="model"></param> + /// <param name="color"></param> + /// <param name="hasToolBox"></param> + /// <param name="hasComputerConnection"></param> + /// <param name="hasArm"></param> + /// <param name="hasTrashCompactor"></param> + /// <param name="hasVacuum"></param> + public Droid_Janitor(string material, string model, string color, bool hasToolBox, bool hasComputerConnection, bool hasArm, bool hasTrashCompactor, bool hasVacuum) + : base(material, model, color, hasToolBox, hasComputerConnection, hasArm) + { + HasTrashCompactor = hasTrashCompactor; + HasVacuum = hasVacuum; + } + + #endregion + + + + #region Properties + + public bool HasTrashCompactor + { + set { hasTrashCompactorBool = value; } + get { return hasTrashCompactorBool; } + } + + public bool HasVacuum + { + set { hasVacuumBool = value; } + get { return hasVacuumBool; } + } + + #endregion + + + + #region Methods + + public override void CalculateTotalCost() + { + base.CalculateTotalCost(); + } + + public override string DisplayToString() + { + return base.DisplayToString() + Environment.NewLine + + "Trash Compactor: " + YesNoString(hasTrashCompactorBool) + Environment.NewLine + + "Vacuum: " + YesNoString(hasVacuumBool); + } + + #endregion + + } +} diff --git a/cis237assignment3/Droid_Protocol.cs b/cis237assignment3/Droid_Protocol.cs new file mode 100644 index 0000000000000000000000000000000000000000..ba93a391123ba52c18b901c638e09eaa58e97b3e --- /dev/null +++ b/cis237assignment3/Droid_Protocol.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cis237assignment3 +{ + /// <summary> + /// Class for Droids of type Protocol. + /// Inherits only from Droid. + /// </summary> + class Droid_Protocol : Droid + { + #region Variables + + protected int numberOfLanguagesInt; + + protected const decimal COST_PER_LANGUAGE = 1; // Temp cost placeholder. + + #endregion + + + + #region Constructor + + /// <summary> + /// Base constructor. + /// </summary> + public Droid_Protocol() + { + + } + + /// <summary> + /// + /// </summary> + /// <param name="material"></param> + /// <param name="model"></param> + /// <param name="color"></param> + /// <param name="numberOfLanguages"></param> + public Droid_Protocol(string material, string model, string color, int numberOfLanguages) + : base(material, model, color) + { + NumberOfLanguages = numberOfLanguages; + } + + #endregion + + + + #region Properties + + public int NumberOfLanguages + { + set { numberOfLanguagesInt = value; } + get { return numberOfLanguagesInt; } + } + + #endregion + + + + #region Methods + + public override void CalculateTotalCost() + { + throw new NotImplementedException(); + } + + public override string DisplayToString() + { + return base.DisplayToString() + Environment.NewLine + + "Languages: " + numberOfLanguagesInt; + } + + #endregion + + } +} diff --git a/cis237assignment3/Droid_Utility.cs b/cis237assignment3/Droid_Utility.cs new file mode 100644 index 0000000000000000000000000000000000000000..7874f3084dc7343d7d8bd0019e9aae6c905cca6c --- /dev/null +++ b/cis237assignment3/Droid_Utility.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cis237assignment3 +{ + /// <summary> + /// Class for Droids of type Utility. + /// Inherits only from Droid. + /// </summary> + class Droid_Utility : Droid + { + #region Variables + + protected bool hasToolBoxBool; + protected bool hasComputerConnectiontBool; + protected bool hasArmBool; + + #endregion + + + + #region Constructor + + /// <summary> + /// Base constructor. + /// </summary> + public Droid_Utility() + { + + } + + /// <summary> + /// + /// </summary> + /// <param name="material"></param> + /// <param name="model"></param> + /// <param name="color"></param> + /// <param name="hasToolbox"></param> + /// <param name="hasComputerConnection"></param> + /// <param name="hasArm"></param> + public Droid_Utility(string material, string model, string color, bool hasToolBox, bool hasComputerConnection, bool hasArm) + : base(material, model, color) + { + HasToolBox = hasToolBoxBool; + HasComputerConnection = hasComputerConnection; + HasArm = hasArm; + } + + #endregion + + + + #region Properties + + public bool HasToolBox + { + set { hasToolBoxBool = value; } + get { return hasToolBoxBool; } + } + + public bool HasComputerConnection + { + set { hasComputerConnectiontBool = value; } + get { return hasComputerConnectiontBool; } + } + + public bool HasArm + { + set { hasArmBool = value; } + get { return hasArmBool; } + } + + #endregion + + + + #region Protected Methods + + /// <summary> + /// Mostly used for UI display. Transforms bool display from "true/false" to "yes/no." + /// </summary> + /// <param name="validationBool">Bool to convert for display.</param> + /// <returns>Appropriate string based on bool.</returns> + protected virtual string YesNoString(bool validationBool) + { + string displayString; + + if (validationBool) + { + displayString = "Yes"; + } + else + { + displayString = "No"; + } + + return displayString; + } + + #endregion + + + + #region Public Methods + + public override void CalculateTotalCost() + { + throw new NotImplementedException(); + } + + + public override string DisplayToString() + { + return base.DisplayToString() + Environment.NewLine + + "Toolbox: " + YesNoString(hasArmBool) + Environment.NewLine + + "Computer Connection: " + YesNoString(hasComputerConnectiontBool) + Environment.NewLine + + "Arm: " + YesNoString(hasArmBool); + } + + #endregion + + } +} diff --git a/cis237assignment3/IDroid.cs b/cis237assignment3/IDroid.cs index f614a058a2434170f29046eca0fdcf88d2474468..d7979a0e5864a396f18263ec8332e93e9018db0c 100644 --- a/cis237assignment3/IDroid.cs +++ b/cis237assignment3/IDroid.cs @@ -6,6 +6,10 @@ using System.Threading.Tasks; namespace cis237assignment3 { + /// <summary> + /// Interface for all droid objects. + /// Acts as a "universal blueprint/contract" of sorts. + /// </summary> interface IDroid { void CalculateTotalCost(); diff --git a/cis237assignment3/UserInterface.cs b/cis237assignment3/UserInterface.cs new file mode 100644 index 0000000000000000000000000000000000000000..d6dfe0349265ea5da3c837757929da8527f72130 --- /dev/null +++ b/cis237assignment3/UserInterface.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cis237assignment3 +{ + /// <summary> + /// Handles all display to user and reading of user input. + /// </summary> + static class UserInterface + { + #region Variables + + private static string userInputString; + + #endregion + + + + #region Constructor + + + + #endregion + + + + #region Properties + + public static string UserInput + { + get { return userInputString; } + } + + #endregion + + + + #region Methods + + + + #endregion + + } +} diff --git a/cis237assignment3/cis237assignment3.csproj b/cis237assignment3/cis237assignment3.csproj index 5d54e105b8c901eefed376336fd04eb44f7ee2f5..658d33fa52d7b48604748f7ec0e81aaea4f2a81a 100644 --- a/cis237assignment3/cis237assignment3.csproj +++ b/cis237assignment3/cis237assignment3.csproj @@ -41,9 +41,16 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="Droid.cs" /> + <Compile Include="DroidCollection.cs" /> + <Compile Include="Droid_Astromech.cs" /> + <Compile Include="Droid_Janitor.cs" /> + <Compile Include="Droid_Protocol.cs" /> + <Compile Include="Droid_Utility.cs" /> <Compile Include="IDroid.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="UserInterface.cs" /> </ItemGroup> <ItemGroup> <None Include="App.config" />