Untitled
unknown
csharp
3 years ago
1.3 kB
8
Indexable
public class Car
{
public string marka;
public string model;
public double engine;
public int year;
public int power;
public string fuel;
}
class Program
{
static void Main(string[] args)
{
Car myCar = new Car(); //конструктор по премълчаване
Console.WriteLine("Въведи марка:");
myCar.marka = Console.ReadLine();
Console.WriteLine(myCar.marka);
Console.WriteLine("Въведи обем на двигател:");
myCar.engine = double.Parse(Console.ReadLine());
Console.WriteLine(myCar.engine);
Console.WriteLine("Въведи година на производство");
myCar.year = int.Parse(Console.ReadLine());
Console.WriteLine(myCar.year);
Console.WriteLine("Въведи конски сили:");
myCar.power = int.Parse(Console.ReadLine());
Console.WriteLine(myCar.power);
Console.WriteLine("Въведи тип гориво:");
myCar.fuel = Console.ReadLine();
Console.WriteLine(myCar.fuel);
}
}Editor is loading...