HELLO, i tried to understand the context, but as an international student i want to make sure that i did it correctly , if someone can verify it with me i will appreciate it, the question is attached below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CarsDemo
{
class Program
{
public class Car
{
public string VehicleIDNumber{get; set;}
public string VehicleMake{get; set;}
public string VehicleModel{get; set;}
public string VehicleColor{get; set;}
public double VehicleValue{get; set;}
public static void DisplayFleet(params Car[] cars)
{
foreach (Car car in cars)
{
Console.WriteLine(car.VehicleIDNumber+" "+car.VehicleMake + " " + car.VehicleModel + " " + car.VehicleColor + " " + car.VehicleValue.ToString("C"));
}
Console.WriteLine();
}
public Car (string vin, string make, string model, string color, double value)
{
VehicleIDNumber = vin;
VehicleMake = make;
VehicleModel = model;
VehicleColor = color;
VehicleValue = value;
}
}
static void Main()
{
Car car1 = new Car("1010V101", "Ford", "Taurus", "Red", 5000.00);
Car car2 = new Car("2020V202", "Geo", "Metro", "Yellow", 338291.99);
Car car3 = new Car("3030V303", "Chevy", "Bolt", "White", 928422.90);
Car car4 = new Car("4040V404", "Hyundai", "Elantra", "Blue", 4551.17);
Car car5 = new Car("5050V505", "Kia", "Rio", "Orange", 24050.00);
Car.DisplayFleet(car1, car2, car3, car4, car5);
}
}
}