Q:

I am a beginner in C# and need help creating a proper method

Ok, here is my assignment at school.

Create a console application named CreateVehicle.
Develop a Vehicle class that captures the following information:
a. Company
b. Model
c. MRSP
d. Number of vehicles created.
Your class should have a null constructor and at least one additional constructor to collect the full information on creation.
Have a method to buy the vehicle.
Create an efficient way to print out all of the information collected on a vehicle.
Develop a class to test your Vehicle class. In this class do the following:
a. Create the following vehicles from the information below:
Car:          Model:    MSRP:
Aston Martin  Vantage   $129,000
Ford          Fusion    $ 28,678.99
Honda         Civic EX  $ 18,713.27

b. Exercise your Buy method by buying the Honda Civic. 
c. Use your print method to print out all relevant information on the vehicles above.
d. When you buy your Honda print out the fact that you bought the Honda.
Bonus points (10). Include a flag item in your class that tells the status of whether the created vehicle was bought or not and have that status print out in your overall Vehicle class print method.

Here is the code I've come up with so far, but I'm not sure where to go from here or how to fix the parts with syntax problems. I'm definitely not sure how my BuyVehicle method is supposed to work:
Program.cs
using System;

namespace CreateVehicle
{
    class Program
    {
        static void Main(string[] args)
        {
            Vehicle firstVehicle = new Vehicle("Aston Martin", "Vantage", 129000);
            Console.WriteLine(firstVehicle.ToString());

            firstVehicle.BuyVehicle(true);
            Console.WriteLine("You bought a {0}", firstVehicle.Model);

            Vehicle secondVehicle = new Vehicle("Ford", "Fusion", 28678.99);
            Console.WriteLine(secondVehicle.ToString());

            Vehicle thirdVehicle = new Vehicle("Honda", "Civic EX", 18713.27);
            Console.WriteLine(thirdVehicle.ToString());

        }
    }
}

Vehicle.cs
using System;

namespace CreateVehicle
{
    class Vehicle
    {
        public string companyName;
        private static int totalVehicles = 0;
        private string mModel;
        private string mMSRP;

        public Vehicle()
        {
            companyName = "Not assigned";
            mModel = "Not assigned";
            mMSRP = 0;

            totalVehicles++;
        }

        public Vehicle(string companyName, string model, double price)
        {
            this.companyName = companyName;
            mModel = model;
            mMSRP = price;

            totalVehicles++;
        } 

        public string Model
        {
            get
            {
                return mModel;
            }
        }

        public decimal MSRP
        {
            get
            {
                return mMSRP;
            }
            set
            {
                if (value >= 0)
                {
                    mMSRP = value;
                }
                else
                {
                    mMSRP = 0;
                }
            }
        }

       public string BuyVehicle(Boolean buy)
        {
            if (buy == true)
            {
                return mModel;
            }
            else
            {
                return "";
        }

        public override string ToString()
        {
            return "Vehicle Data:  \n\t" +
                   "Company Name:   " + companyName + "\n\t" +
                   "Model:          " + mModel + "\n\t" +
                   "MSRP:           " + mMSRP.ToString("C") + "\n\t" +
                   "Total vehicles: " + totalVehicles + "\n";
        }
    }
}

A:

Have a look at variable declaration for mMSRP? You've declared it as a string but then your assigning it to a 0. Then your constructor is expecting a double and then in your accessor your expecting to return a decimal. This is why I was telling you to step through your code. Not only with vs but with your eyes following its path where its declared. If your still having errors let me know what the errors are. The purpose of this site is to help point you in the direction not give you the answer. You will learn so much more figuring it out yourself and the satifaction

