static void modifyOdometer(Garage myGarage) { string vehType; string manufacturer = ""; string model = ""; int modelYear = 0; double initPrice = 0.0; int purchaseDate = 0; double currentOdometer = 0.0; double engineSize = 0.0; string type = ""; int doorNumber = 0; string fuelType = ""; double cargoCapacity = 0.0; double towingCapacity = 0.0; double newOdometer = 0.0; Console.WriteLine("On what vehicle do you want to change the odometer value? Motorcycle, Automobile, Small Truck"); vehType = Console.ReadLine(); getGeneral(ref manufacturer, ref model, ref modelYear, ref initPrice, ref purchaseDate, ref currentOdometer, ref engineSize); if ((vehType == "Motorcycle") || (vehType == "motorcycle")) { getMoto(ref type); int pos = myGarage.Find(manufacturer, model, modelYear, initPrice, purchaseDate, currentOdometer, engineSize, type); if (pos != -1) { getNewOdometer(ref newOdometer); if (myGarage.ChangeOdometer(pos, newOdometer) == true) { Console.WriteLine("\nChanged\n"); } else { Console.WriteLine("\nInvalud value\n"); } } else { Console.WriteLine("\nNo such Vehicle\n"); } } else if ((vehType == "Automobile") || (vehType == "automobile")) { getAuto(ref doorNumber, ref fuelType); int pos = myGarage.Find(manufacturer, model, modelYear, initPrice, purchaseDate, currentOdometer, engineSize, doorNumber, fuelType); if (pos != -1) { getNewOdometer(ref newOdometer); if (myGarage.ChangeOdometer(pos, newOdometer) == true) { Console.WriteLine("\nChanged\n"); } else { Console.WriteLine("\nInvalud value\n"); } } else { Console.WriteLine("\nNo such Vehicle\n"); } } else if ((vehType == "Small Truck") || (vehType == "small truck") || (vehType == "Small truck") || (vehType == "small Truck")) { getTruck(ref cargoCapacity, ref towingCapacity); int pos = myGarage.Find(manufacturer, model, modelYear, initPrice, purchaseDate, currentOdometer, engineSize, cargoCapacity, towingCapacity); if (pos != -1) { getNewOdometer(ref newOdometer); if (myGarage.ChangeOdometer(pos, newOdometer) == true) { Console.WriteLine("\nChanged\n"); } else { Console.WriteLine("\nInvalud value\n"); } } else { Console.WriteLine("\nNo such Vehicle\n"); } } }
static void delete(Garage myGarage) { string vehType; string manufacturer = ""; string model = ""; int modelYear = 0; double initPrice = 0.0; int purchaseDate = 0; double currentOdometer = 0.0; double engineSize = 0.0; string type = ""; int doorNumber = 0; string fuelType = ""; double cargoCapacity = 0.0; double towingCapacity = 0.0; Console.WriteLine("What vehicle do you want to delete? Motorcycle, Automobile, Small Truck"); vehType = Console.ReadLine(); getGeneral(ref manufacturer, ref model, ref modelYear, ref initPrice, ref purchaseDate, ref currentOdometer, ref engineSize); if ((vehType == "Motorcycle") || (vehType == "motorcycle")) { getMoto(ref type); int pos = myGarage.Find(manufacturer, model, modelYear, initPrice, purchaseDate, currentOdometer, engineSize, type); if (pos != -1) { while (true) { Console.WriteLine("Are you sure you want to delete this vehicle?"); string confirm = Console.ReadLine(); if ((confirm == "Yes") || (confirm == "yes") || (confirm == "Y") || (confirm == "y")) { myGarage.Delete(pos, vehType); Console.WriteLine("\nDeleted\n"); break; } else if ((confirm == "No") || (confirm == "no") || (confirm == "N") || (confirm == "n")) { Console.WriteLine("\nCanceled deletion\n"); break; } else { Console.WriteLine("\nInvalid input, try again\n"); } } } else { Console.WriteLine("\nNo such Vehicle\n"); } } else if ((vehType == "Automobile") || (vehType == "automobile")) { getAuto(ref doorNumber, ref fuelType); int pos = myGarage.Find(manufacturer, model, modelYear, initPrice, purchaseDate, currentOdometer, engineSize, doorNumber, fuelType); if (pos != -1) { while (true) { Console.WriteLine("Are you sure you want to delete this vehicle?"); string confirm = Console.ReadLine(); if ((confirm == "Yes") || (confirm == "yes") || (confirm == "Y") || (confirm == "y")) { myGarage.Delete(pos, vehType); Console.WriteLine("\nDeleted\n"); break; } else if ((confirm == "No") || (confirm == "no") || (confirm == "N") || (confirm == "n")) { Console.WriteLine("\nCanceled deletion\n"); break; } else { Console.WriteLine("\nInvalid input, try again\n"); } } } else { Console.WriteLine("\nNo such Vehicle\n"); } } else if ((vehType == "Small Truck") || (vehType == "small truck") || (vehType == "Small truck") || (vehType == "small Truck")) { getTruck(ref cargoCapacity, ref towingCapacity); int pos = myGarage.Find(manufacturer, model, modelYear, initPrice, purchaseDate, currentOdometer, engineSize, cargoCapacity, towingCapacity); if (pos != -1) { while (true) { Console.WriteLine("Are you sure you want to delete this vehicle?"); string confirm = Console.ReadLine(); if ((confirm == "Yes") || (confirm == "yes") || (confirm == "Y") || (confirm == "y")) { myGarage.Delete(pos, vehType); Console.WriteLine("\nDeleted\n"); break; } else if ((confirm == "No") || (confirm == "no") || (confirm == "N") || (confirm == "n")) { Console.WriteLine("\nCanceled deletion\n"); break; } else { Console.WriteLine("\nInvalid input, try again\n"); } } } else { Console.WriteLine("\nNo such Vehicle\n"); } } }