This is what my lab says to do

Start Main( ) or btnRun_Click( )
    Create a RaceCar object
    Set the car name to “Fast One”
    Set the x coordinate to 200
    Set the y coordinate to 100
    Call the car’s Move( ) method and show the resulting message
    Display a blank line to separate the two object results
    Create an Employee object
    Set the employee’s first name to “Joe” and last name to “Student”
    Set the phone to “555-1111”
    Set the annual salary to 74395.11
    Call the employee’s CalculatePay( ) method and display the weekly pay amount
Stop

This is how I did it and I am getting errors

using System.Text;

namespace Lab2
{
    public class Main
    {
        //Create a RaceCar object
        public static void RaceCar();
    //Set the car name to “Fast One”
        string name = "Fast One";
    //Set the x coordinate to 200
        int x = 200;
    //Set the y coordinate to 100
        int y = 100;
    //Call the car’s Move( ) method and show the resulting message
    public void Move();
        //Display a blank line to separate the two object results
        Console.ReadLine();
    //Create an Employee object
        public void Employee();
    //Set the employee’s first name to “Joe” and last name to “Student”
        string fname = "Joe";
        string lname = "Student";
    //Set the phone to “555-1111”
        string phone = "555-1111";
    //Set the annual salary to 74395.11
        double AnnualSalary = 74395.11;
    //Call the employee’s CalculatePay( ) method and display the weekly pay amount
        public void CalculatePay();
    }
}

Anyone know what I am doing wrong here?

Edited 3 Years Ago by mike_2000_17: Fixed formatting

public static void RaceCar(); //error
public RaceCar raceCarInstance = new RaceCar(); //correct
raceCarInstance.X = ....
raceCarInstance.Y = ....
public void Move(); //wrong
raceCarInstance.Move();//correct
public void Employee();//wrong
public Employee employeeInstance = new Employee();//correct
employeeInstance.fname = ....
employeeInstance.lname = ....
employeeInstance.phone = ....
....
Please read in OOP before coding in C#, that's not good start in coding.

When I put the = it says invalid token. Is it supposed to be another symbol? This is what I have now.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lab2
{
    public class Main
    {
        //Create a RaceCar object
        public RaceCar raceCarInstance = new RaceCar();
        //Set the car name to “Fast One”
        raceCar.name = "Fast One";
        //Set the x coordinate to 200
        raceCarInstance.X = 200
        //Set the y coordinate to 100
        raceCarInstance.Y = 100;
        //Call the car’s Move( ) method and show the resulting message
        raceCarInstance.Move();
        //Display a blank line to separate the two object results
        Console.ReadLine();
        //Create an Employee object
        public Employee employeeInstance = new Employee();
        //Set the employee’s first name to “Joe” and last name to “Student”
        employeeInstance.fname = "Joe";
        employeeInstance.lname = "Student";
    //Set the phone to “555-1111”
        employeeInstance.phone = "555-1111";
    //Set the annual salary to 74395.11
        employeeInstance.AnnualSalary = 74395.11;
    //Call the employee’s CalculatePay( ) method and display the weekly pay amount
        public void CalculatePay();
    }
}

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.