public void AddNewItem(string MaterialString, string ModelString, string ColorString, bool ToolboxBool, bool ComputerConnectionBool, bool ArmBool, bool TrashCompactorBool, bool VacuumBool) { droidItemsCollection[droidItemsLengthInt] = new Janitor(MaterialString, ModelString, ColorString, ToolboxBool, ComputerConnectionBool, ArmBool, TrashCompactorBool, VacuumBool); droidItemsLengthInt++; }
// this method is designed to add a new droid to the droid list private void AddDroid() { Console.WriteLine("Input Droid ID Number"); string droidNumber = Convert.ToString(Console.ReadLine().ToUpper()); Console.WriteLine("Select Droid Type"); Console.WriteLine("1: Protocol"); Console.WriteLine("2: Utility"); string droidType = Convert.ToString(Console.ReadLine()); string droidModel = "NULL"; if (droidType == "2") { droidType = "Utility"; Console.WriteLine("Select Droid Model"); Console.WriteLine("1: Janitor"); Console.WriteLine("2: Astromech"); droidModel = Convert.ToString(Console.ReadLine()); if (droidModel == "1") { Janitor newDroid = new Janitor(); } else { Astromech newDroid = new Astromech(); } } else { Protocol newDroid = new Protocol(); } Console.WriteLine("Input Droid's Body Color"); string droidBColor = Convert.ToString(Console.ReadLine().ToUpper()); Console.WriteLine("Input Droid's Detail Color"); string droidDColor = Convert.ToString(Console.ReadLine().ToUpper()); Console.WriteLine("Input Droid's Primary Material"); string droidMaterial = Convert.ToString(Console.ReadLine().ToUpper()); string content = droidNumber + " " + droidType + " " + droidModel + " " + droidBColor + " " + droidDColor + " " + droidMaterial; dC.Add(content); }
public void AddDroid(IDroid[] droidList, int Index) { UserInterface ui = new UserInterface(); string model; int type = ui.GetAddInput(); string material = ui.GetMaterial(); string color = ui.GetColor(); if (type == 3) { model = "Protocol"; int numberOfLanguages = ui.GetLanguages(); droidList[Index] = new Protocol(model, material, color, numberOfLanguages); } else { bool toolbox = ui.getTool(); bool compConn = ui.getComp(); bool arm = ui.getArm(); if (type == 1) { model = "Astromech"; bool fire = ui.GetFire(); int numShips = ui.GetShips(); droidList[Index] = new Astromech(model, material, color, toolbox, compConn, arm, fire, numShips); } if (type == 2) { model = "Janitor"; bool trashCompact = ui.GetTrash(); bool vaccum = ui.GetVac(); droidList[Index] = new Janitor(model, material, color, toolbox, compConn, arm, trashCompact, vaccum); } if (type == 4) { model = "Utility"; droidList[Index] = new Utility(model, material, color, toolbox, compConn, arm); } } }
//CONSTRUCTOR THAT ADDS A NEW JANITOR DROID public void addDroid(string ModelType, string MaterialType, string PaintColor, bool HasToolbox, bool ComputerConnected, bool HasArm, bool HasTrashCompactor, bool HasVacuum) { Janitor newDroid = new Janitor(ModelType, MaterialType, PaintColor, HasToolbox, ComputerConnected, HasArm, HasTrashCompactor, HasVacuum); droidCollection.Add(newDroid); }
public void addJanitorDroid(string Material, string Model, string Color, bool ToolBox, bool ComputerConnection, bool Arm, bool TrashCompactor, bool Vacuum) { Janitor newDroid = new Janitor(Material, Model, Color, ToolBox, ComputerConnection, Arm, TrashCompactor, Vacuum); collectedDroids.Add(newDroid); }
public void AddJanitor(string Model, string Material, string Color, bool ToolBox, bool ComputerConnection, bool Arm, bool TrashCompactor, bool Vacuum) { droidArray[counter] = new Janitor(Material, Model, Color, ToolBox, ComputerConnection, Arm, TrashCompactor, Vacuum); counter++; }
private static void AddDroid(DroidCollecion droidCollection, UserInterface userInterface) { //istantiate variables DroidCollecion dc = droidCollection; UserInterface ui = userInterface; IDroid droid = null; string droidMaterial; string droidColor; string droidType; int droidNumberLanguages; bool droidToolBox; bool droidComputerConnection; bool droidArm; bool droidFireExtingusher; int droidNumberShips; bool droidTrashCompactor; bool droidVacuum; try //catch incorrect entries { ui.DroidMaterial(); droidMaterial = ui.ReadLine(); ui.DroidColor(); droidColor = ui.ReadLine(); ui.DroidType(); droidType = ui.ReadLine(); if (droidType == "Astromech") //astromech path { //utility variables ui.ToolBoxAsk(); droidToolBox = Convert.ToBoolean(ui.ReadLine()); ui.ComputerConnectionAsk(); droidComputerConnection = Convert.ToBoolean(ui.ReadLine()); ui.ArmAsk(); droidArm = Convert.ToBoolean(ui.ReadLine()); //Astromech variables ui.FireExtinguisher(); droidFireExtingusher = Convert.ToBoolean(ui.ReadLine()); ui.NumberShips(); droidNumberShips = Convert.ToInt32(ui.ReadLine()); //create new astromech in the droid variable droid = new Astromech(droidMaterial, droidType, droidColor, droidToolBox, droidComputerConnection, droidArm, droidFireExtingusher, droidNumberShips); } else if (droidType == "Janitor") //janitor path { //Utitlity variables ui.ToolBoxAsk(); droidToolBox = Convert.ToBoolean(ui.ReadLine()); ui.ComputerConnectionAsk(); droidComputerConnection = Convert.ToBoolean(ui.ReadLine()); ui.ArmAsk(); droidArm = Convert.ToBoolean(ui.ReadLine()); //Janitor variables ui.TrashCompactor(); droidTrashCompactor = Convert.ToBoolean(ui.ReadLine()); ui.Vacuum(); droidVacuum = Convert.ToBoolean(ui.ReadLine()); //Create new janitor in the droid variable droid = new Janitor(droidMaterial, droidType, droidColor, droidToolBox, droidComputerConnection, droidArm, droidTrashCompactor, droidVacuum); } else if (droidType == "Protocol") //protocol path { //Protocol variables ui.DroidLanguages(); droidNumberLanguages = Convert.ToInt32(ui.ReadLine()); //create new Protocol droid in the droid variable droid = new Protocol(droidMaterial, droidType, droidColor, droidNumberLanguages); } else { ui.DroidTypeError(); //output type error message } } catch { ui.Print("Invalid entry"); } if (droid == null) //if no droid was made do not add it to the list { ui.DroidNotAdded(); } else { //if the droid is made add it to the list } { dc.AddDroid(droid); ui.DroidAdded(); } }
//Add new Janitor Droid to the Droid Collection and increase the length variable. public void NewDroid(String model, String material, String color, Boolean toolbox, Boolean computerConnection, Boolean arm, Boolean trashCompactor, Boolean vacuum) { droids[droidsLength] = new Janitor(model, material, color, toolbox, computerConnection, arm, trashCompactor, vacuum); droidsLength++; }
/// <summary> /// ***********Problems*********** /// Dosen't save to file or print from file correctly /// Not sure if im useing calculate methods from othe classes right /// No UI, Will work before next assgnment /// Not a lot or very detail comment(have to get used to commenting while i code) /// /// </summary> /// <param name="args"></param> static void Main(string[] args) { //Variables string materialSelected = string.Empty; string modelSelected; string colorSelected; bool toolboxSelected; bool computerConnectionSelected; bool armSelected; bool trashCompatSelected; bool vacuumSelected; bool fireExtingSelected; int numOfChips; int numberOfLanguage; string userInput = string.Empty; DroidCollection newDroid = new DroidCollection(); // Console.Write("It Still Runs!!!!!!!!!!!"); while (userInput != "e") { Console.WriteLine("Type n to add a new droid"); Console.WriteLine("Type p to print droid"); Console.WriteLine("Type e to exit"); Console.Write("Select an opetion: "); userInput = Console.ReadLine(); Console.WriteLine("----------------"); if (userInput == "n") { // All droid Units go throuh this procees Console.WriteLine("--------------------"); Console.Write("Material: "); materialSelected = Console.ReadLine(); Console.Write("Model: "); modelSelected = Console.ReadLine(); Console.Write("Color: "); colorSelected = Console.ReadLine(); Console.Write("Droid Model: "); Console.WriteLine("Protocol, Utility, Janitor, Astromech"); Console.WriteLine("selcet a Droid"); userInput = Console.ReadLine(); //if protocol is selceted if (userInput.Equals("protocol", StringComparison.OrdinalIgnoreCase )) { Console.Write("Number of Language: "); numberOfLanguage = Int32.Parse(Console.ReadLine()); newDroid.addProtocolDroid(materialSelected, modelSelected, colorSelected, numberOfLanguage);// adds user input newDroid.saveDroidList();// saves user input Console.WriteLine("------------------"); } // if utility is selected else if (userInput.Equals("utility", StringComparison.OrdinalIgnoreCase )) { Console.Write("Tool box yes or no "); toolboxSelected = ToBool(Console.ReadLine()); Console.Write("Computer Connection yes or no "); computerConnectionSelected = ToBool(Console.ReadLine()); Console.Write("Arm yes or no "); armSelected = ToBool(Console.ReadLine()); newDroid.addUtilityDroid(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected);// adds user input newDroid.saveDroidList();// saves user input } // if janitor is selected else if(userInput.Equals("janitor", StringComparison.OrdinalIgnoreCase )) { Console.Write("Tool box yes or no "); toolboxSelected = ToBool(Console.ReadLine()); Console.Write("Computer Connection yes or no "); computerConnectionSelected = ToBool(Console.ReadLine()); Console.Write("Arm yes or no "); armSelected = ToBool(Console.ReadLine()); Console.Write("Trash Compactoer yes or no "); trashCompatSelected = ToBool(Console.ReadLine()); Console.Write("Vacuum yes or no "); vacuumSelected = ToBool(Console.ReadLine()); newDroid.addJanitorDroid(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected, trashCompatSelected, vacuumSelected);// adds user input newDroid.saveDroidList();// saves user input Janitor janitorCost = new Janitor(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected, trashCompatSelected, vacuumSelected);//creates new Janitor object so we can you the methods eith n that class janitorCost.CalculateBaseCost();// Calculate methods from astromech janitorCost.CalculateTotalCost(); } //If astromec is selected else if (userInput.Equals("astromech" , StringComparison.OrdinalIgnoreCase )) { Console.Write("Tool box yes or no "); toolboxSelected = ToBool(Console.ReadLine()); Console.Write("Computer Connection yes or no "); computerConnectionSelected = ToBool(Console.ReadLine()); Console.Write("Arm yes or no "); armSelected = ToBool(Console.ReadLine()); Console.Write("FireExtingquisher yes or no "); fireExtingSelected = ToBool(Console.ReadLine()); Console.Write("Number of Chips "); numOfChips = Int32.Parse(Console.ReadLine()); newDroid.addAstromechDroid(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected, fireExtingSelected, numOfChips); // adds user input newDroid.saveDroidList(); // saves user input Astromech astromechCost = new Astromech(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected, fireExtingSelected, numOfChips); //creates new astromech object so we can you the methods eith n that class astromechCost.CalculateBaseCost(); // Calculate methods from astromech astromechCost.CalculateTotalCost(); } else { Console.WriteLine(userInput +" Is Not an Option"); Console.WriteLine("------------"); } } //Print save file else if (userInput == "p") { newDroid.PrintSDroidList(); } } }
public void addDroid(string Model, string Material, string Color, bool Toolbox, bool ComputerConnection, bool Arm, bool TrashCompactor, bool Vacuum) { Janitor newDroid = new Janitor(Model, Material, Color, Toolbox, ComputerConnection, Arm, TrashCompactor, Vacuum); droidList.Add(newDroid); }
/// <summary> /// ***********Problems*********** /// Dosen't save to file or print from file correctly /// Not sure if im useing calculate methods from othe classes right /// No UI, Will work before next assgnment /// Not a lot or very detail comment(have to get used to commenting while i code) /// /// </summary> /// <param name="args"></param> static void Main(string[] args) { //Variables string materialSelected = string.Empty; string modelSelected; string colorSelected; bool toolboxSelected; bool computerConnectionSelected; bool armSelected; bool trashCompatSelected; bool vacuumSelected; bool fireExtingSelected; int numOfChips; int numberOfLanguage; string userInput = string.Empty; DroidCollection newDroid = new DroidCollection(); // Console.Write("It Still Runs!!!!!!!!!!!"); while (userInput != "e") { Console.WriteLine("Type n to add a new droid"); Console.WriteLine("Type p to print droid"); Console.WriteLine("Type e to exit"); Console.Write("Select an opetion: "); userInput = Console.ReadLine(); Console.WriteLine("----------------"); if (userInput == "n") { // All droid Units go throuh this procees Console.WriteLine("--------------------"); Console.Write("Material: "); materialSelected = Console.ReadLine(); Console.Write("Model: "); modelSelected = Console.ReadLine(); Console.Write("Color: "); colorSelected = Console.ReadLine(); Console.Write("Droid Model: "); Console.WriteLine("Protocol, Utility, Janitor, Astromech"); Console.WriteLine("selcet a Droid"); userInput = Console.ReadLine(); //if protocol is selceted if (userInput.Equals("protocol", StringComparison.OrdinalIgnoreCase)) { Console.Write("Number of Language: "); numberOfLanguage = Int32.Parse(Console.ReadLine()); newDroid.addProtocolDroid(materialSelected, modelSelected, colorSelected, numberOfLanguage); // adds user input newDroid.saveDroidList(); // saves user input Console.WriteLine("------------------"); } // if utility is selected else if (userInput.Equals("utility", StringComparison.OrdinalIgnoreCase)) { Console.Write("Tool box yes or no "); toolboxSelected = ToBool(Console.ReadLine()); Console.Write("Computer Connection yes or no "); computerConnectionSelected = ToBool(Console.ReadLine()); Console.Write("Arm yes or no "); armSelected = ToBool(Console.ReadLine()); newDroid.addUtilityDroid(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected); // adds user input newDroid.saveDroidList(); // saves user input } // if janitor is selected else if (userInput.Equals("janitor", StringComparison.OrdinalIgnoreCase)) { Console.Write("Tool box yes or no "); toolboxSelected = ToBool(Console.ReadLine()); Console.Write("Computer Connection yes or no "); computerConnectionSelected = ToBool(Console.ReadLine()); Console.Write("Arm yes or no "); armSelected = ToBool(Console.ReadLine()); Console.Write("Trash Compactoer yes or no "); trashCompatSelected = ToBool(Console.ReadLine()); Console.Write("Vacuum yes or no "); vacuumSelected = ToBool(Console.ReadLine()); newDroid.addJanitorDroid(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected, trashCompatSelected, vacuumSelected); // adds user input newDroid.saveDroidList(); // saves user input Janitor janitorCost = new Janitor(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected, trashCompatSelected, vacuumSelected); //creates new Janitor object so we can you the methods eith n that class janitorCost.CalculateBaseCost(); // Calculate methods from astromech janitorCost.CalculateTotalCost(); } //If astromec is selected else if (userInput.Equals("astromech", StringComparison.OrdinalIgnoreCase)) { Console.Write("Tool box yes or no "); toolboxSelected = ToBool(Console.ReadLine()); Console.Write("Computer Connection yes or no "); computerConnectionSelected = ToBool(Console.ReadLine()); Console.Write("Arm yes or no "); armSelected = ToBool(Console.ReadLine()); Console.Write("FireExtingquisher yes or no "); fireExtingSelected = ToBool(Console.ReadLine()); Console.Write("Number of Chips "); numOfChips = Int32.Parse(Console.ReadLine()); newDroid.addAstromechDroid(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected, fireExtingSelected, numOfChips); // adds user input newDroid.saveDroidList(); // saves user input Astromech astromechCost = new Astromech(materialSelected, modelSelected, colorSelected, toolboxSelected, computerConnectionSelected, armSelected, fireExtingSelected, numOfChips); //creates new astromech object so we can you the methods eith n that class astromechCost.CalculateBaseCost(); // Calculate methods from astromech astromechCost.CalculateTotalCost(); } else { Console.WriteLine(userInput + " Is Not an Option"); Console.WriteLine("------------"); } } //Print save file else if (userInput == "p") { newDroid.PrintSDroidList(); } } }