Let’s Create, .NET! Project ATM Part 2 – Create our ATM class

Let’s check that our test works.

Create a new class in the main project that will be an ATM object that will have a property for our balance.

    public class ATM
        private int balance;
        public int Balance
            get { return balance; }
            set { balance = value; }

Now let’s create a method that adds to our balance and returns our updated balance.

 public int Add(int amount)
      return Balance = Balance + amount; 

Perfect! Now in the next post we’ll test this method.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: