using System;
/*
* Name: Mel Vincent Anonuevo
* SIN: 301167069
* Date: Sept 14, 2021
*/
namespace Week01_Lab_Cars
{
class Program
{
static void Main(string[] args)
{
TestCars();
}
static void TestCars()
{
Cars a = new Cars(2018, "Audi", "R6", 30000, false);
Console.WriteLine(a);
Cars b = new Cars(2019, "BMW", "i3", 40000, true);
Console.WriteLine(b);
Cars c = new Cars(2020, "Chevrolet", "Traverse", 32000, true);
Console.WriteLine(c);
Cars f = new Cars(2021, "Ford", "F150", 35000, true);
Console.WriteLine(f);
Cars t = new Cars(2022, "Toyota", "4runner", 40000, true);
Console.WriteLine(t);
}
}
class Cars
{
private int year;
private string manufacturer;
private string model;
private bool isDrivable;
private double price;
//Constructor
/*public Cars(int yr, string manu, string mdl, double prce, bool isDrivable =
true)
{
year = yr;
manufacturer = manu;
model = mdl;
price = prce;
}*/
public Cars(int year, string manufacturer, string model, double price, bool
isDriveable = true)
{
this.year = year;
this.manufacturer = manufacturer;
this.model = model;
this.price = price;
this.isDrivable = isDriveable;
}
public override string ToString()
{
//return $"{year}, {manufacturer}, {model}, {price}, {isDrivable}";
return $"Year: {year}, Manufacturer: {manufacturer}, Model: {model}, Price:
{price}, IsDrivable?: {(isDrivable? "Drivable" : "Not Drivable")}";
}