❔ working with classes and they arent working
FIRST FILE CODE:
second file code:
my current errors are shown in the screenshots provided...
namespace GetAndSetMethods
{
class Automobile
{
private string make;
private string model;
private string vin;
private string color;
private int year;
private string type;
public enum autoType
{
Sedan,
Truck,
Van,
SUV
}
public string GetMake(){
return make;
}
public void SetMake(string newMake){
make = newMake;
}
public string GetModel(){
return model;
}
public void SetModel(string newModel){
model = newModel;
}
public string GetVin(){
return vin;
}
public void SetVin(string newVin){
vin = newVin;
}
public string GetColor(){
return color;
}
public void SetColor(string newColor){
color = newColor;
}
public int GetYear(){
return year;
}
public void SetYear(int newYear){
year = newYear;
}
public string GetType(){
return type;
}
public void SetType(string AutoType){
type = autoType;
}
}
} namespace GetAndSetMethods
{
class Automobile
{
private string make;
private string model;
private string vin;
private string color;
private int year;
private string type;
public enum autoType
{
Sedan,
Truck,
Van,
SUV
}
public string GetMake(){
return make;
}
public void SetMake(string newMake){
make = newMake;
}
public string GetModel(){
return model;
}
public void SetModel(string newModel){
model = newModel;
}
public string GetVin(){
return vin;
}
public void SetVin(string newVin){
vin = newVin;
}
public string GetColor(){
return color;
}
public void SetColor(string newColor){
color = newColor;
}
public int GetYear(){
return year;
}
public void SetYear(int newYear){
year = newYear;
}
public string GetType(){
return type;
}
public void SetType(string AutoType){
type = autoType;
}
}
} second file code:
namespace class_assignment;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\nCreating the first Automobile\n---------------");
Automobile auto1 = new Automobile("Tesla", "Model X", 2020, "12345", "blue", AutoType.Sedan);
Console.WriteLine($"Make: {auto1.getMake()} \nModel: {auto1.getModel()}\nYear: {auto1.getYear()}\nType: {auto1.getType()} \nVIN: {auto1.getVin()}");
Console.WriteLine($"Color: {auto1.getColor()}");
Console.WriteLine("\nChanging the Colour\n---------------");
auto1.setColor("black");
Console.WriteLine($"Color: {auto1.getColor()}");
Console.WriteLine("\nCreating the second Automobile\n---------------");
Automobile auto2 = new Automobile("Mercedes", "G-Wagon", 2017, "24578", "silver", AutoType.SUV);
Console.WriteLine($"Make: {auto2.getMake()}\nModel: {auto2.getModel()}\nYear: {auto2.getYear()}\nType: {auto2.getType()}\nVIN: {auto2.getVin()}");
Console.WriteLine("\nPrinting Automobile Ages\n---------------");
Console.WriteLine($"Auto1 Age: {auto1.getAutoAge()} years");
Console.WriteLine($"Auto2 Age: {auto2.getAutoAge()} years");
}
}namespace class_assignment;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\nCreating the first Automobile\n---------------");
Automobile auto1 = new Automobile("Tesla", "Model X", 2020, "12345", "blue", AutoType.Sedan);
Console.WriteLine($"Make: {auto1.getMake()} \nModel: {auto1.getModel()}\nYear: {auto1.getYear()}\nType: {auto1.getType()} \nVIN: {auto1.getVin()}");
Console.WriteLine($"Color: {auto1.getColor()}");
Console.WriteLine("\nChanging the Colour\n---------------");
auto1.setColor("black");
Console.WriteLine($"Color: {auto1.getColor()}");
Console.WriteLine("\nCreating the second Automobile\n---------------");
Automobile auto2 = new Automobile("Mercedes", "G-Wagon", 2017, "24578", "silver", AutoType.SUV);
Console.WriteLine($"Make: {auto2.getMake()}\nModel: {auto2.getModel()}\nYear: {auto2.getYear()}\nType: {auto2.getType()}\nVIN: {auto2.getVin()}");
Console.WriteLine("\nPrinting Automobile Ages\n---------------");
Console.WriteLine($"Auto1 Age: {auto1.getAutoAge()} years");
Console.WriteLine($"Auto2 Age: {auto2.getAutoAge()} years");
}
}my current errors are shown in the screenshots provided...

