Assignment Exercise 6-Windows App Bank Account Management with Class Object


The objectives of this lab assignment are as follows:


Create a fully functioning desktop application

Create a custom class that will be used by the main program.

Skills Required

To properly complete this assignment, you will need to apply the following skills:


Construct Windows desktop GUI application

Work with a class that consists of a private field, auto-implemented public properties having getters and setters, class constructor method, and various public methods that will be called by the main application.

Work with C# List<> structure.

Work with an enumeration.

Implement logic in methods.

Important: There is a lot to learn before you can code this application. You must learn the terminology around the use and coding of classes. It is critical that you come to an understanding of classes, objects, instantiation, constructors, fields, properties, methods, getters and setters, scope, and access modifiers. Failure to understand these components of class development means that you will not be able to complete this assignment successfully.


This guide is purposefully long, but very detailed. Follow it. Much of your misunderstanding in developing this application can be avoided by reading carefully and closely. This is your responsibility.




Supplementary Information

You should look at the following websites to gain a better understanding of the materials that comprise the programming constructs with which you will be working.


DotNetPerls: Constructor

DotNetPerls: Enum (Enumeration)

DotNetPerls: Property Examples (look specifically for auto-implemented "Automatic" properties)

DotNetPerls: List

Assignment User Story

As a user, I want a new Windows application that acts as a bank account management program that one would find at any automatic teller machine (ATM). This program should have simple deposit, withdrawal, and account balance functionality.


The most critical component of this software consists of a well-designed class that will be instantiated by the code from the user interface.


Assignment Requirements

Design a program which acts as an ATM machine. When the program first loads the account number (hard-coded) and the initial balance (specified in code) will be displayed. With a simple interface, the user will be able to both deposit to and withdraw funds from their account. Another option will allow the user to see the account balance history in order of most recent transaction to the oldest.


Business Logic Rules

Allow the user to deposit or withdraw money from their account. The rules for these two transaction types are as follows:



A single deposit greater than $10,000.00 is not allowed. Remember, this is an ATM and such a large deposit would have to be done in person.


Withdrawals of any amount are allowed (with specific rules for insufficient funds handling).

If the result of a withdrawal yields an account balance that is positive, then the withdrawal is accepted.

If, as a result of the withdrawal, the account balance will be negative but not less than $100.00- (negative one hundred dollars) then the withdrawal is allowed but the user will be charged an overdraft fee of $35.75.

If, as a result of the withdrawal, the account balance will be negative by $100 or more then the withdrawal is not allowed, and the user will not be charged a fee.


When your application begins, the starting account balance will be set to $1,362.59

When your application begins, the account number will be set to 000302019

Technical Requirements

This may sound like a simple application, and, in truth it is. But this is made more complex by virtue that you must implement a custom class to handle the bank account management. It is important that you understand the technical requirements as you will be graded on your implementation of the details.


If, as you are reading the technical requirements, you don't understand a term or a concept you must spend the time in research to gain the understanding you need to implement the features of this program the way that they are conveyed to you. Do not take shortcuts; do not take it upon yourself to do something outside the scope of this guide. There is a reason you are being directed in specific ways in the coding of this application.


Bank Account Class

You will create a new class named BankAccount.cs, and this class will handle all functions related to the management of your account.



This class must have a constructor method. And you will pass the account balance and account number into this method. The balance and account number values are defined in the Assignment Requirements section above. Remember, these values do not originate in this class; they are passed into this class by way of the constructor method.


In addition to the class's constructor, you will define the following publicly accessible methods:






With respect to the Deposit() and Withdrawal() methods, each has only one parameter—the amount of money either to be deposited into or withdrawn from the account. These methods must observe the business rules defined in the Assignment Requirements section above. Both of these methods will return an enumeration of the status of the transaction.


The GetAccountStatus() method will return an enumeration (more on this below) indicating whether the account is in Ok or Overdrawn status. The calling program will receive one of these two status values and will display a message box with an appropriate message.


The GetAccountBalance() method will return the current value of the account balance.


For each of the Deposit() , Withdrawal(), and GetAccountStatus() methods the return data-type is the enumeration that you define (more below).



It is important that you learn what class fields and properties are and how they are defined/coded. This class will define the following fields and properties:


A field whose purpose is to hold the account balance. This field—is NOT a property—and will not be accessible from the calling/invoking program. The value of this field will be made available to your calling program only through the GetAccountBalance() method. Its initial value will be set by the account balance value passed into the constructor method. This field must be private in scope.

A property whose purpose is to hold the account number. This property—is NOT a field—and will be accessible for read-only access to the calling/invoking program. The value of this field will be set by the account number value passed into the constructor method. Though public in scope, this property, by virtue of being read-only, can only bet set in the constructor method.

A property whose purpose is to hold a List<> of the account balance each time a new balance is calculated. Though public in scope it will have a private setter which means that it's value cannot be changed by the calling/invoking program but will be capable of being set within any of the methods of the class. This makes sense as both the Deposit() and Withdrawal() methods may yield a new account balance. And each time a new account balance is calculated it must be placed into the list for historical purposes.


You must learn what an enumeration is and how it is defined. This enumeration will be defined in the bank account class. And it will have four elements Ok, Overdrawn, InsufficientFunds, and DepositTooLarge.


This enumeration MUST be public in scope as the calling/invoking program must be able to see it.


Furthermore, you must decide where in the class to define the enumeration: it can be placed within the namespace or within the class definition. Where you place it will have implications for how it is accessed by the calling/invoking program. If it is placed in the namespace then your calling/invoking program will have immediate access to it. If it is placed in the class definition, then the calling/invoking program will be able to access it only through the class object (the instantiation of the class).


Within the Deposit() method you will determine if the transaction results in an Ok or DepositTooLarge status (when the transaction amount is greater than $10,000) being returned from the method.


Within the Withdrawal() method you will determine if the transaction results in an Ok, InsufficientFunds, or Overdrawn status being returned from the method. If the withdrawal places the account into a negative value but that value is not more than 100.00- then the status is Overdrawn. If, however, the transaction would result in a negative balance of more than 100.00- or if the account is already negative then the status is InsufficientFunds.


Within the AccountStatus() method if the account balance is zero or positive then the status is Ok. If the account balance is negative then the status is Overdrawn.



The account balance and transaction amount data-types must be decimal . Do NOT use a double for your data-type.


When you set the initial account balance to the required value of $1,362.59 you will receive a compile error because the compile thinks you are setting a decimal variable with a numeric literal that is of type double. How do you handle this mismatch?


Calling/Invoking Program (The GUI)

This program will be the main entry-point of your application and will handle all the code-behind of the graphical user interface. Further, it will instantiate a new instance of the BankAccount class.


Important : Because your instance variable for the class must be available throughout the entire GUI class this means that you MUST instantiate this variable within the GUI class and not within any of its methods.


Your application, when first loaded must instantiate a new instance of the BankAccount class. Then, it must retrieve the account number and balance from the class to display to the user on the form. You will be passing these two values into the class's constructor when you instantiate the class object. DO NOT simply pass these values into the form. I want you to retrieve them from the instance variable—from the class.



Your application will provide the following functionality.


Close button, that will terminate the application.

Get History button that will retrieve the account balances. Each time you deposit or withdraw from your account you will calculate a new balance. The history is simply a display of the dollar values of your running account balance totals, but in reverse order of the transactions. This means that it shows the most recent balances first.

Get Status button that will display a simple message box showing whether the account is in good standing or if it is overdrawn.


The main functionality is the ability to select whether to perform a Deposit into or a Withdrawal from the account. These options should be represented as radio buttons on your form.

You will have a transaction amount field which needs to be validated to ensure what the user enters is a valid number value.

You will have a Submit button that will invoke the code to perform the deposit or withdrawal. And that code will call the methods of the instance object.

Because the Withdrawal() and Deposit() methods return a status (enumeration) you will display the status for the transaction, which can be any one of the following:

Transaction Successful.

Your account is overdrawn. Please make a deposit.

Your account has insufficient funds for this transaction.

The transaction amount is too large and cannot be submitted.

Grading Requirements

You must ensure that the application you submit meets all technical/grading requirements. Your grade will be based on how well your application follows the application requirements plus the following:


A Windows Forms (desktop) application will be developed.

The account number, account balance, and transaction status controls will all be set to be read-only.

All transaction and account balance variables will be of data-type decimal (NOT double).

The transaction amount entered will be validated to ensure the user entered a valid numeric value.

Read and understand everything in this guide and implement your application exactly as specified here.

As a final note to the above requirements, because this is a Windows desktop application you must submit a zip of the entire project folder for grading purposes. A desktop application contains multiple files beyond just the code file that must be kept together.


How the application looks and how it presents its information to the user is up to you. But it must meet the minimum requirements noted above.


Final Thoughts

This entire exercise is intended to be an exercise in class construction with a heavy emphasis on the use of methods.


These are the building blocks of all modern application development practices. This is OOP (Object-Oriented Programming). And knowledge of OOP is an absolute requirement for any programming job, anywhere

Need a custom answer at your budget?

This assignment has been answered 6 times in private sessions.

© 2024 Codify Tutor. All rights reserved