Jump to content

Can someone help me out I have no idea what is wrong c#

cerealsneaky

So my whole class has a whole centeral peice of code and the teacher has wrote the code out and everything but I litterally dont know what I am doing wrong. I am very new to OOP and have no idea whats happening.This is c# btw.

 

namespace DanielsBank
{
    //base class 
    class BankAccount
    {

        protected int _accountNumber = 0;
        protected DateTime _Opendate;
        protected decimal _balance;


        public decimal Balance
        {
            get { return _balance; }
            set { _balance = value; }
        }
        public int AccountNumber
        {
            get { return _accountNumber; }
            set { _accountNumber = value; }
        }

        public DateTime Opendate
        {

            get { return _Opendate; }
            set { _Opendate = value; }
        }

        public bool Deposit(decimal depositAmount)
        {
            _balance = _balance + depositAmount;

            return true;
        }

        public bool Withdraw(decimal withdrawAmount)
        {

            _balance = _balance - withdrawAmount;
            return true;

        }

    }
}
namespace DanielsBank
{
    //specialised 
    class savingsAccount
    {
        private decimal _interestRate;


        public decimal interestRate
        {
            get { return _interestRate; }
            set { _interestRate = value; }
        }

        public bool applyInterest()

        {
            _balance = _balance + (interestRate / 100m) * _balance;
            return true;
        }
    }
}

namespace DanielsBank
{
    class linkingClasses
    {
        public bool Open(Customer newCustomer)

        {

            if (newCustomer != null)

            {

                _accountCustomer = newCustomer;

                newCustomer.AccountNumber = AccountNumber;

                return true;

            }

            else

            {

                return false;

            }

        }
    }
}
namespace DanielsBank
{
    class bankAccountMainProg
    {
        //New Customer Account Sequence 

        Customer customerOne = new Customer();



        Console.WriteLine("Customer Details:\n-----------------\n"); 

            //Console.Write("Please enter cutomer forename: "); 

            //customerOne.Forename = Console.ReadLine(); 

            customerOne.Forename = Utility.Console.Ask("Enter Customer Forename: "); 

 

            customerOne.Surname = Utility.Console.Ask("Enter Customer Surname: "); 

 

            customerOne.Address = Utility.Console.Ask("Enter Customer Address: "); 

 

            customerOne.Town = Utility.Console.Ask("Enter Customer Town: "); 

 

            customerOne.PostCode = Utility.Console.Ask("Enter Customer Post Code: "); 

 

            CurrentAccount accountCurrOne = new CurrentAccount();

        accountCurrOne.AccountNumber = 1000; 

 

            SavingsAccount accountSavOne = new SavingsAccount();

        accountSavOne.AccountNumber = 1001; 

 

            accountCurrOne.Open(customerOne); 

            accountSavOne.Open(customerOne); 

 

            //Initial deposit 

            decimal depositAmount;

        depositAmount = decimal.Parse(Utility.Console.Ask("Enter initial deposit: ")); 

 

            accountCurrOne.Deposit(depositAmount); 

            accountSavOne.Deposit(depositAmount); 

 

            // End of New Customer Account Sequence 

 

 

            Console.ReadLine(); 
    }
}
namespace DanielsBank
{
    class OverdraftLimit
    {
        private decimal _OverdraftLimit;
        private decimal _OverdraftChange;
    }

    public decimal OverdraftLimit
    {
        get { return _OverdraftLimit; }
        set { OverdraftLimit = value; }
    }

    public decimal _OverdraftChange
    {
        get { return _OverdraftChange; }
        set { _OverdraftChange = value; }
    }

    public bool chargeFee()
    {
        _accountBalance = _accountBalance - _OverdraftChange;
        return true;
    }

}

 

Link to comment
Share on other sites

Link to post
Share on other sites

What is going wrong? What did you expect to happen?

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, minibois said:

What is going wrong? What did you expect to happen?

Its meant collect customer info and put it back out to the user.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, cerealsneaky said:

Its meant collect customer info and put it back out to the user.

Please be more specific.

Your title me toons something is going wrong, your topic mentions you don't know what's going on.

 

Does the code not run alright, or do you want an explanation of what the code does?

 

Not trying to be rude here, I just don't really know what your question is here.

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, minibois said:

Please be more specific.

Your title me toons something is going wrong, your topic mentions you don't know what's going on.

 

Does the code not run alright, or do you want an explanation of what the code does?

 

Not trying to be rude here, I just don't really know what your question is here.

A lot of things have gone wrong and I honestly dont know what the code does and like its not even working the first place

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×