Auto Service CLI Part2
unknown
csharp
2 years ago
4.9 kB
9
Indexable
string data = "Алемхан@4:2:2$4:2:1:yes$4:1:1:yes"; string[] dataSplit = data.Split('@'); string name = dataSplit[0]; //name string[] options = dataSplit[1].Split('$'); string[] wheels = options[0].Split(':'); string[] doors = options[1].Split(":"); string[] salon = options[2].Split(":"); int absentWheelsAmount = Convert.ToInt32(wheels[0]) - Convert.ToInt32(wheels[1]); int fixedWheelsAmount = Convert.ToInt32(wheels[2]); int damagedWheelsAmount = Convert.ToInt32(wheels[1]) - Convert.ToInt32(wheels[2]); int absentDoorsAmount = Convert.ToInt32(doors[0]) - Convert.ToInt32(doors[1]); int fixedDoorsAmount = Convert.ToInt32(doors[2]); int damagedDoorsAmount = Convert.ToInt32(doors[1]) - Convert.ToInt32(doors[2]); bool isScratchedDoors = doors[3] == "yes" ? true : false; int absentSalonAmount = Convert.ToInt32(salon[0]) - Convert.ToInt32(salon[1]); int damagedSalonAmount = Convert.ToInt32(salon[1]) - Convert.ToInt32(salon[2]); int fixedSalonAmount = Convert.ToInt32(salon[2]); bool isDamageDashboard = salon[3] == "yes" ? false : true; // - Установка колеса - 30000, 30 минут // -Ремонт колеса - 5000, 12 минут int wheelsRepairSumm = 0; int wheelsRepairTime = 0; int wheelsInstallationSumm = 0; int doorsInstallationSumm = 0; int doorsInstallationTime = 0; int wheelsInstallationTime = 0; int doorsRepairSumm = 0; int doorsRepairTime = 0; int isScratchedDoorsFixSumm = 0; int isScratchedDoorsFixTime = 0; int salonInstallationSumm = 0; int salonInstallationTime = 0; int salonRepairSumm = 0; int salonRepairTime = 0; int dashboardRepairSum = 0; int dashboardRepairTime = 0; if (absentWheelsAmount > 0) { wheelsInstallationSumm = absentWheelsAmount * 30000; wheelsInstallationTime = absentWheelsAmount * 30; } if (fixedWheelsAmount > 0) { wheelsRepairSumm = fixedWheelsAmount * 5000; wheelsRepairTime = fixedWheelsAmount * 12; } // - Установка двери - 60000, 40 минут // - Ремонт двери - 30000, 20 минут // - Заделывание царапин - 10000, 10 минут if (absentDoorsAmount > 0) { doorsInstallationSumm = absentDoorsAmount * 60000; doorsInstallationTime = absentDoorsAmount * 40; } if (fixedDoorsAmount > 0) { doorsRepairSumm = fixedDoorsAmount * 30000; doorsRepairTime = fixedDoorsAmount * 20; } if (isScratchedDoors) { isScratchedDoorsFixSumm = 10000; isScratchedDoorsFixTime = 10; } //- Установка сидения - 70000, 60 минут //- Ремонт сидения - 30000, 20 минут //- Ремонт панели - 50000, 60 минут if (absentSalonAmount > 0) { salonInstallationSumm = absentSalonAmount * 70000; salonInstallationTime = absentSalonAmount * 60; } if (fixedSalonAmount > 0) { salonRepairSumm = fixedSalonAmount * 30000; salonRepairTime = fixedSalonAmount * 20; } if (isDamageDashboard) { dashboardRepairSum = 50000; dashboardRepairTime = 60; } // Алемхан, диагностика показала: // Нуждается ремонт - 2 колеса (10000), 3 сидения(90000), приборная панель(50000) // Нуждается в установке - 2 сидения (60000) // Итого: 210000 тг.и ~ время работ Console.WriteLine($"{name}, диагностика показала:"); if (absentDoorsAmount > 0 || absentWheelsAmount > 0 || absentSalonAmount > 0) { Console.Write("Нуждается в установке - "); if (absentWheelsAmount > 0) { Console.Write($"{absentWheelsAmount} колёс ({wheelsInstallationSumm}), "); } if (absentDoorsAmount > 0) { Console.Write($"{absentDoorsAmount} дверей ({doorsInstallationSumm}), "); } if (absentSalonAmount > 0) { Console.Write($"{absentSalonAmount} сидения ({salonInstallationSumm}), "); } } Console.WriteLine(); if (damagedDoorsAmount > 0 || damagedWheelsAmount > 0 || damagedSalonAmount > 0 || isScratchedDoors || isDamageDashboard) { Console.Write("Нуждается в ремонте - "); if (damagedWheelsAmount > 0) { Console.Write($"{damagedWheelsAmount} колёс ({wheelsRepairSumm}), "); } if (damagedSalonAmount > 0) { Console.Write($"{damagedSalonAmount} сидения ({salonRepairSumm}), "); } if (damagedDoorsAmount > 0) { Console.Write($"{damagedDoorsAmount} дверей ({doorsRepairSumm}), "); } if (isScratchedDoors) { Console.Write($"заделывание царапин ({isScratchedDoorsFixSumm}), "); } if (isDamageDashboard) { Console.Write($"приборная панель ({dashboardRepairSum}) "); } }
Editor is loading...
Leave a Comment