Question
C#: Complete the coding in this project REQUIREMENT A transaction includes the following information: when the transaction occurred, the amount of the transaction, the kind
C#: Complete the coding in this project
REQUIREMENT
A transaction includes the following information: when the transaction occurred, the amount of the transaction, the kind of transaction (deposit, withdrawal, service fee), and whether the transaction has cleared the bank.
1) The transaction amount should be tested to make sure it is a positive number.
2) The transaction date should also be tested to be sure a date has been entered, and the date is on or before today.
3) Each transaction must have a transaction type specified (deposit, service fee, withdrawal).
4) A withdrawal cannot cause the actual balance to be less than zero (a service fee can result in a negative balance).
NOTE: Two account balances need to be tracked: actual and processed (cleared). The actual account balance changes when a new transaction is created IF all of the requirements are met. The processed balance changes if all of the requirements are met AND the transaction is marked as processed.
5) Create a class-level two-dimensional string array to hold each transaction, and a class-level integer to track where in the array to assign the next transaction entry.
NOTE: The process button is to add a new transaction. If the entry is valid, use the class-level integer to assign the transaction values to the appropriate elements in the array. Also add the transaction information in the listbox as an item in the listbox and update the account balances.
The listbox on the included form should show all transactions. When a new transaction is created, add information about the transaction to the list box as a string (date, amount, type of transaction, and whether the transaction has been processed).
When an entry in the listbox is selected, display the data for that transaction in the appropriate controls.
The clear button sets up the form for entering a new transaction.
The exit button (coded) simply closes the form.
Enamespace CheckingArray 3 references public partial class MainForm Form public MainForm() InitializeComponent); 1 reference private void ClearForm() cboTransactionType.SelectedIndex -2; I/ make withdrawal the default choice txtTransactionDate . Text = DateTime . Today . ToShortDateSt ring(); // default to today's date txtTransactionAmount.Clear(); II clear amount chkProcessed.Checkedfalse; I1 default to transaction not processed cboTransactionType.Focus); // make first user control active 1 reference private void MainForm_Load(object sender, EventArgs e) // add transaction types to combobox cboTransactionType.Items.Add("Deposit"); cboTransactionType.Items.Add("Service Fee"); cboTransactionType.Items.Add("Withdrawal"); // set up form for new entry ClearForm(); 1 reference private void btnExitClick (object sender, EventArgs e) this.close)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started