AutoService CLI part2
unknown
csharp
2 years ago
3.1 kB
18
Indexable
string data = "Алемхан@4:3:1$4:3:1:yes$4:3:1:yes"; string[] dataSplit = data.Split('@'); string name = dataSplit[0]; string dataProperties = dataSplit[1]; string[] dataPropertiesSplit = dataProperties.Split('$'); //string[] d = { "4:4:2", "4:2:1:no", "4:4:1:yes"}; string wheels = dataPropertiesSplit[0]; string korpus = dataPropertiesSplit[1]; string salon = dataPropertiesSplit[2]; string[] wheelsProperties = wheels.Split(':'); // string[] w = {"4", "4", "2"}; int wheelsTotal = Convert.ToInt32(wheelsProperties[0]); int wheelsFact = Convert.ToInt32(wheelsProperties[1]); int wheelsCorrected = Convert.ToInt32(wheelsProperties[2]); string[] korpusProperties = korpus.Split(":"); int doorTotal = Convert.ToInt32(korpusProperties[0]); int doorFact = Convert.ToInt32(korpusProperties[1]); int doorCorrected = Convert.ToInt32(korpusProperties[2]); bool doorScratch = korpusProperties[3] == "yes" ? true : false; string[] salonProperties = salon.Split(":"); int salonTotal = Convert.ToInt32(salonProperties[0]); int salonFact = Convert.ToInt32(salonProperties[1]); int salonCorrected = Convert.ToInt32(salonProperties[2]); bool dashboardCorrected = salonProperties[3] == "yes" ? true : false; // Алемхан, диагностика показала: // Нуждается ремонт - 2 колеса (10000), 3 сидения(90000), приборная панель(50000) // Нуждается в установке - 2 сидения (60000) // Итого: 210000 тг.и ~время работ Console.WriteLine($"{name}, диагностика показала:"); if (wheelsFact - wheelsCorrected > 0 || doorFact - doorCorrected > 0 || salonFact - salonCorrected > 0 || !dashboardCorrected || doorScratch) { Console.Write("Вам нужно отремонтировать: "); if (doorFact - doorCorrected > 0) { Console.Write($"{doorFact - doorCorrected} дверь(ей), "); } if (wheelsFact - wheelsCorrected > 0) { Console.Write($"{wheelsFact - wheelsCorrected} колёс(о), "); } if (salonFact - salonCorrected > 0) { Console.Write($"{salonFact - salonCorrected} сидений(е), "); } if (!dashboardCorrected) { Console.Write("приборную панель, "); } if (doorScratch) { Console.Write("царапины"); } Console.WriteLine(); } else { Console.WriteLine("Вам не нужно ничего ремонтировать"); } if (wheelsTotal - wheelsFact > 0 || doorTotal - doorFact > 0 || salonTotal - salonFact > 0) { Console.Write("Нуждается в установке - "); if (wheelsTotal - wheelsFact > 0) { Console.Write($"{wheelsTotal - wheelsFact} колёс(о), "); } if (doorTotal - doorFact > 0) { Console.Write($"{doorTotal - doorFact} дверь(ей), "); } if (salonTotal - salonFact > 0) { Console.Write($"{salonTotal - salonFact} сидений(е), "); } } else { Console.Write("Вам не нужно ничего устанавливать"); }
Editor is loading...
Leave a Comment