Пространство имен не может непосредственно содержать такие элементы, как поля или методы
Создайте проект с именем BankAccountTester. Создайте класс с именем BankAccount. Банковский счет имеет поля для баланса. Баланс банковского счета должен быть инициализирован на 0. Класс банковского счета должен включать депозит, который добавляет переданную ему сумму к балансу, и снятие, которое вычитает эту сумму.
Что я уже пробовал:
using System; namespace Banking { public static void Main(string []args) { } //A bank account has a balance //that can be changed with // withdraw or deposit. public class BankAccount { private double balance; //constructs a bank account // with zero balance public BankAccount() { balance = 0; } //Constructs a bank account //with a given balance //(initalBalance) public BankAccount(double initialBalance) { balance = initialBalance; } //Deposits money into the bank account. //(amount the amount to deposit) public void Deposit(double amount) { double newBalance = balance + amount; balance = newBalance; } //Withdraws money from the bank account //(the amount to withdraw) public void Withdraw(double amount) { double newBalance = balance - amount; balance = newBalance; } //Gets the current balance of the bank account. //(returns the current balance) public double GetBalance() { Console.ReadLine(); return balance; } } }