Create a BankAccount Class that can be used to maintain a bank account balance. Include appropriate constructors, properties, and methods to enable the account to be originally created and for amounts to be deposited and withdrawn for the account. Write the NegativeException class to extend the ApplicationExecption class to include the additional functionality of a new message detailing the error being sent when the exception is thrown. Throw the NegativeException when a negative value is entered to initially create the account or if a negative value is entered for a deposit or withdrawal. Include additional exception-handling techniques. Write an application class and test the exception-handling techniques.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

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

namespace BankAccount
    class BankAccount
       private double balance;

       public BankAccount()
            balance = 0;

       public BankAccount(double balance)
            if (balance < 0)
                NegativeException ne = new NegativeException("Exception type: a negative value is entered ");
                throw ne;
            this.balance = balance;

       public void depsit(double amount)
            if (amount < 0)
                NegativeException ne = new NegativeException("Exception type: a negative value is entered ");
                throw ne;
            this.balance += amount;
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats