//Zmiana koloru interfejsu na czarny public static void DarkMode() { Console.ResetColor(); Console.Clear(); Logo.AppLogo(1); BikeToolsMenu.Menu(); }
//Zmiana koloru interfajsu na bialy public static void WhiteMode() { Console.Clear(); Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; Console.Clear(); Logo.AppLogo(1); BikeToolsMenu.Menu(); }
//Zmina koloru interfesju na losowy kolor public static void RandomMode() { Random color = new Random(); Console.Clear(); Console.ForegroundColor = (ConsoleColor)color.Next(0, 7); Console.BackgroundColor = (ConsoleColor)color.Next(8, 16); Console.Clear(); Logo.AppLogo(1); BikeToolsMenu.Menu(); }
//Menu główne programu obsługiwane za pomoca switcha public static void Menu() { Console.WriteLine("\n1. Kalkulator rozmiaru ramy"); Console.WriteLine("2. Kalkulator czasu jazdy Ebike"); Console.WriteLine("3. Kalkulator BMI"); Console.WriteLine("4. Prezent urodzinowy"); Console.WriteLine("5. Color mode"); Console.WriteLine("6. INFO"); Console.WriteLine("\n0. KONIEC\n"); string h = ""; while ((h != "0") && (h != "1") && (h != "2") && (h != "3") && (h != "4") && (h != "5") && (h != "6")) { h = Console.ReadLine(); } Sounds.EnterSound(); switch (h) { case "1": KalkulkatorRam.KalRam(); break; case "2": KalkulatorCzasuEbike.KalDysEbike(); break; case "3": KalkulatorBMI.BMI(); break; case "4": Sounds.SupriseSound(); BikeToolsMenu.Menu(); break; case "5": ColorMode.ColorMenu(); break; case "6": BikeToolsInfo.Info(); break; case "0": Loaders.ClosingLoader(); System.Environment.Exit(1); break; } }
//Pobranie danych do kalkulatora BMI //Wyświetlenie BMI wraz z komentarzem public static void BMI() { Console.WriteLine("\nPodaj wagę w kilogramach: "); if (double.TryParse(Console.ReadLine(), out double weight)) { Sounds.EnterSound(); Console.WriteLine("\nPodaj wzrost w centymetrach: "); if (double.TryParse(Console.ReadLine(), out double height)) { Sounds.EnterSound(); Loaders.ProgressBar(); BMIlogic(weight, height, out double result); Console.WriteLine("\nTwoje BMI to: " + string.Format("{0:.0}", result)); if (result < 16) { Console.WriteLine("Waga zdecydowanie za niska"); } else if (result < 18.5) { Console.WriteLine("Waga za nisaka"); } else if (result < 25) { Console.WriteLine("Waga w normie"); } else if (result < 30) { Console.WriteLine("Waga za wysoka"); } else if (result > 30) { Console.WriteLine("Waga zdecydowanie za wysoka"); } Sounds.SuccessSound(); Console.WriteLine(); } else { Sounds.FailSound(); BMI(); } } else { Sounds.FailSound(); BMI(); } BikeToolsMenu.Menu(); }
//Obsługa zmiany koloru interfejsu public static void ColorMenu() { Console.WriteLine("\n1. Dark Mode"); Console.WriteLine("2. White Mode"); Console.WriteLine("3. Random Mode"); Console.WriteLine("0. Menu\n"); string h = Console.ReadLine(); while ((h != "0") && (h != "1") && (h != "2") && (h != "3")) { Sounds.FailSound(); h = Console.ReadLine(); } switch (h) { case "1": Sounds.EnterSound(); DarkMode(); break; case "2": Sounds.EnterSound(); WhiteMode(); break; case "3": Sounds.EnterSound(); RandomMode(); break; case "0": Sounds.EnterSound(); BikeToolsMenu.Menu(); break; } }
//Kalkulator wielkośći ram na podstawie wzrostu //Logika oparta na pętli oraz tablicach jednowymiarowych public static void KalRam() { string[] frameSizeM = { "33-36 cm (13\" - 14\")", "35-38 cm (14\" - 15\")", "38-40 cm (15\" - 16\")", "40-43 cm (16\" - 17\")", "42-45 cm (16,5\" - 17, 5\")", "44-47 cm (17,5\" - 18, 5\")", "46-49 cm (18\" - 19\"), 49-52 cm (19\" - 20, 5\")", "51-56 cm (20,5\"-22\")", "od 56 cm (od 22\")" }; string[] frameSizeR = { "47-49 cm", "49-51 cm", "51- 53 cm", "53-55 cm", "55-57 cm", "57-60 cm", "60- 62 cm", "62-64 cm", "od 64 cm" }; Console.WriteLine("\nPodaj wzrost: "); bool success = int.TryParse(Console.ReadLine(), out int wzrost); if (success) { Sounds.EnterSound(); Console.WriteLine("\nWybierz rodzaj roweru: \n"); Console.WriteLine("1. Rower MTB"); Console.WriteLine("2. Rower szosowy\n"); string b = Console.ReadLine(); while ((b != "1") && (b != "2")) { Sounds.FailSound(); b = Console.ReadLine(); } Sounds.EnterSound(); switch (b) { case "1": int j = 155; if (wzrost >= 150 && wzrost <= 200) { for (int n = 0; n <= 10; n++) { if (wzrost <= j) { Sounds.SuccessSound(); Console.WriteLine("\nOdpowiedni rozmiar ramy MTB to " + frameSizeM[n]); n = 10; } else { j += 5; } } } else { Sounds.FailSound(); Console.WriteLine("\nAby dobrać odpowiedni rozmiar dla twojego wzrostu, polecamy udać się na konsultacje w sklepie rowerowym."); } break; case "2": int t = 160; if (wzrost >= 155 && wzrost <= 200) { for (int n = 0; n <= 10; n++) { if (wzrost <= t) { Sounds.SuccessSound(); Console.WriteLine("\nOdpowiedni rozmiar ramy szosowej to " + frameSizeR[n]); n = 10; } else { t += 5; } } } else { Sounds.FailSound(); Console.WriteLine("\nAby dobrać odpowiedni rozmiar dla twojego wzrostu, polecamy udać się na konsultacje w sklepie rowerowym."); } break; } BikeToolsMenu.Menu(); } else { Sounds.FailSound(); KalRam(); } }
//informacje o autorze public static void Info() { Console.WriteLine("\nPaweł Sałata \nInformatyka i Ekonometria 2019/2020 niestacjonarne \nNumer indeku 12455"); BikeToolsMenu.Menu(); }
//Pobranie danych dla kalkulatora czasu jazdy na rowerze elektrycznym //obliczenie czasu uwzględniająć poziom doładowania public static void KalDysEbike() { double level = 1.0; string mode = "high"; Console.WriteLine("\nAby oszacować czas jazdy na Ebike wprowadz dane:\n - liczba aperogodzin (Ah)\n - Napięcie (V) \n - moc silnika (W) \n"); Console.WriteLine("Wprowadz liczbę amperogodzin"); if (double.TryParse(Console.ReadLine(), out double ah)) { Sounds.EnterSound(); } else { Sounds.FailSound(); KalDysEbike(); } Console.WriteLine("Wprowadz napięcie"); if (double.TryParse(Console.ReadLine(), out double v)) { Sounds.EnterSound(); } else { Sounds.FailSound(); KalDysEbike(); } Console.WriteLine("Wprowadz moc silnika"); if (double.TryParse(Console.ReadLine(), out double w)) { Sounds.EnterSound(); } else { Sounds.FailSound(); KalDysEbike(); } Console.WriteLine("\nWybierz stopień wspomagania: \n 1. Low\n 2. Medium\n 3. High\n"); string h = Console.ReadLine(); while ((h != "1") && (h != "2") && (h != "3")) { Sounds.FailSound(); h = Console.ReadLine(); } Sounds.EnterSound(); switch (h) { case "1": mode = "low"; level = 1.75; break; case "2": mode = "medium"; level = 1.50; break; case "3": mode = "high"; level = 1.0; break; } double time; time = (((ah * v) / w) * 60) * level; Loaders.ProgressBar(); Sounds.SuccessSound(); Console.WriteLine("\n\nSzacunkowy czas jazdy w trybie doładowania " + mode + " to " + string.Format("{0:.0}", time) + " minut"); BikeToolsMenu.Menu(); }