public static void MenuAfterCreatingUser() { Console.WriteLine("|---------------------------------------------------------|"); Console.WriteLine("| Welcome to RentACar Company based in This Virtual World |"); Console.WriteLine("|---------------------------------------------------------|"); Console.WriteLine(); Console.WriteLine("1: Create User "); Console.WriteLine("2: Show Vehicles "); Console.WriteLine("3: Exit "); int userInput = int.Parse(Console.ReadLine()); switch (userInput) { case 1: User.CreateUser(); Console.Clear(); MenuAfterCreatingUser(); break; case 2: Console.Clear(); Sedan.CreateCarObject(); MenuAfterShowVehicles(); break; case 3: Console.WriteLine("Thanks for your time. Press enter to exit program."); Console.ReadKey(); Environment.Exit(1); break; } }
// Method for creating every car as an object, and putting it into a list. public void CreateCarObject() { Sedan Saab1 = new Sedan(Manufacturer.Saab, false, 4, "JON001", 1000); Sedan Saab2 = new Sedan(Manufacturer.Saab, true, 4, "EGH002", 1000); Sedan BMV1 = new Sedan(Manufacturer.BMW, false, 4, "LOR001", 1000); Sedan BMV2 = new Sedan(Manufacturer.BMW, true, 4, "MAH002", 1000); Sedan Toyota1 = new Sedan(Manufacturer.Toyota, false, 4, "DAN001", 1000); Sedan Toyota2 = new Sedan(Manufacturer.Toyota, true, 4, "SOD007", 1000); Sedan Volvo1 = new Sedan(Manufacturer.Volvo, false, 4, "MAT001", 1000); Sedan Volvo2 = new Sedan(Manufacturer.Volvo, true, 4, "VAI002", 1000); Sedan Mercedes1 = new Sedan(Manufacturer.Mercedes, false, 4, "AND001", 1000); Sedan Mercedes2 = new Sedan(Manufacturer.Mercedes, true, 4, "PON002", 1000); List <Sedan> ListOfCars = new List <Sedan>(); ListOfCars.Add(Saab1); ListOfCars.Add(Saab2); ListOfCars.Add(BMV1); ListOfCars.Add(BMV2); ListOfCars.Add(Toyota1); ListOfCars.Add(Toyota2); ListOfCars.Add(Volvo1); ListOfCars.Add(Volvo2); ListOfCars.Add(Mercedes1); ListOfCars.Add(Mercedes2); }
public static void CalculateRentalTimeDays() { Sedan sedan = new Sedan(1000); double TotalCostDays = userDaysInput * sedan.DailyPrice + BookinFee; Console.WriteLine($"TotalcostDays: {TotalCostDays} {sedan.DailyPrice}"); //Here we add days! }
/// <summary> /// Creating every car as an object, and putting it into a list. /// </summary> public static void CreateCarObject() { Sedan Saab1 = new Sedan(Manufacturer.Saab, false, 4, "JON001", 1000); Sedan Saab2 = new Sedan(Manufacturer.Saab, true, 4, "EGH002", 1000); Sedan BMV1 = new Sedan(Manufacturer.BMW, false, 4, "LOR001", 1000); Sedan BMV2 = new Sedan(Manufacturer.BMW, true, 4, "MAH002", 1000); Sedan Toyota1 = new Sedan(Manufacturer.Toyota, false, 4, "DAN001", 1000); Sedan Toyota2 = new Sedan(Manufacturer.Toyota, true, 4, "SOD007", 1000); Sedan Volvo1 = new Sedan(Manufacturer.Volvo, false, 4, "MAT001", 1000); Sedan Volvo2 = new Sedan(Manufacturer.Volvo, true, 4, "VAI002", 1000); Sedan Mercedes1 = new Sedan(Manufacturer.Mercedes, false, 4, "AND001", 1000); Sedan Mercedes2 = new Sedan(Manufacturer.Mercedes, true, 4, "PON002", 1000); //Simplifierat koden nedan då den suggestade att man kunde korta ner den. //kommenterade bort den andra så kan vi bestämma hur vi vill ha det listOfCars = new List <Sedan> { Saab1, Saab2, BMV1, BMV2, Toyota1, Toyota2, Volvo1, Volvo2, Mercedes1, Mercedes2 /* * ListOfCars.Add(Saab1); * ListOfCars.Add(Saab2); * ListOfCars.Add(BMV1); * ListOfCars.Add(BMV2); * ListOfCars.Add(Toyota1); * ListOfCars.Add(Toyota2); * ListOfCars.Add(Volvo1); * ListOfCars.Add(Volvo2); * ListOfCars.Add(Mercedes1); * ListOfCars.Add(Mercedes2); */ }; foreach (var car in listOfCars) { Console.WriteLine(car.RegistrationNumber); } Console.ReadKey(); }