Code
using System;
namespace _03_07
{
class Car
{
public string color;
private float weight;
private DateTime releasedate;
public static int count = 0;
public string Color
{
get
{
return color;
}
set
{
color = value;
}
}
public float Weight
{
get
{
return weight;
}
set
{
weight = value;
}
}
public Car()
{
Color = "Red";
}
}
class Class_03_07
{
public static void Main(String[] args)
{
int[] intArray = new int[10];
Random rd = new Random();
for(int i = 0; i < intArray.Length; ++i)
{
intArray[i] = rd.Next();
}
for(int i = 0; i < intArray.Length; ++i)
{
Console.WriteLine("intArray[" + i + "] = " + intArray[i]);
}
Car[] carArray = new Car[10];
for(int i = 0; i < carArray.Length; ++i)
{
carArray[i] = new Car();
}
carArray[0].Color = "Blue";
carArray[5].Color = "White";
carArray[9].Color = "Black";
for(int i = 0; i < carArray.Length; ++i)
{
Console.WriteLine("carArray[" + i + "].Color = " + carArray[i].Color);
}
}
}
}
using System;
namespace _03_07
{
class Car
{
public string color;
private float weight;
private DateTime releasedate;
public static int count = 0;
public string Color
{
get
{
return color;
}
set
{
color = value;
}
}
public float Weight
{
get
{
return weight;
}
set
{
weight = value;
}
}
public Car()
{
Color = "Red";
}
}
class Class_03_07
{
public static void Main(String[] args)
{
int[] intArray = new int[10];
Random rd = new Random();
for(int i = 0; i < intArray.Length; ++i)
{
intArray[i] = rd.Next();
}
for(int i = 0; i < intArray.Length; ++i)
{
Console.WriteLine("intArray[" + i + "] = " + intArray[i]);
}
Car[] carArray = new Car[10];
for(int i = 0; i < carArray.Length; ++i)
{
carArray[i] = new Car();
}
carArray[0].Color = "Blue";
carArray[5].Color = "White";
carArray[9].Color = "Black";
for(int i = 0; i < carArray.Length; ++i)
{
Console.WriteLine("carArray[" + i + "].Color = " + carArray[i].Color);
}
}
}
}