Untitled
unknown
csharp
2 years ago
1.9 kB
5
Indexable
double correction = 1.75;
int minPrice = 400;
Console.Write("ОТКУДА:");
string from = Console.ReadLine();
Console.Write("КУДА:");
string to = Console.ReadLine();
Console.WriteLine("Ваш заказ принят!");
Random random = new Random();
int randomLength = random.Next(1, 5);
int randomPressure = random.Next(1, 3);
string randomPressureText;
if (randomPressure > 2.4)
{
randomPressureText = "большая";
}
else if (randomPressure > 2.0)
{
randomPressureText = "средняя";
}
else if (randomPressure > 1.5)
{
randomPressureText = "маленькая";
}
else if (randomPressure > 0.0)
{
randomPressureText = "нет";
}
double price = randomLength / correction * randomPressure * minPrice;
if (price < minPrice)
{ price = minPrice; }
Console.WriteLine($"Вы поедите с {from} до {to} расстояние - {randomLength} км"); ;
Console.WriteLine($"Стоимость поездки: {price}");
Console.WriteLine($"Ваш водитель: {});
Driver[] testDriver = new Driver[]
{
new Driver("Abylay",Cars[1]
new Driver("Shynggys",Cars[2]),
new Driver("Yerassyl",Cars[3])
};
Cars[] testCars = new Cars[]
{
new Cars("Toyota","Rav4","White","123ABS06"),
new Cars("Nissan","X-Trail","Black","456CDF05"),
new Cars("Mazda","X3","Yellow","789KJH04")
};
class Driver
{
string Name;
public Cars[] Cars;
public Driver(string name, Cars[] cars)
{
Name = name;
Cars = cars;
}
};
class Cars
{
string CarType;
string Model;
string Color;
string Number;
public Cars(string carType, string model, string color, string number)
{
CarType = carType;
Model = model;
Color = color;
Number = number;
}
}
Editor is loading...
Leave a Comment