Programming Assignment #4 - 50 points Customer Bank Account Application Enhancements (Windows Application-OOP Assignment using Classes/Inheritance/Polymorphism/Exception Handling/Enums) Program...

1 answer below »
I have a google drive for this assignment but I'm stuck at the OOP class, interface. Please help me!
https://drive.google.com/file/d/1KG4eR1Tn6rt1d74awL1BhV4AB2ZeGT3E/view?usp=sharing


Programming Assignment #4 - 50 points Customer Bank Account Application Enhancements (Windows Application-OOP Assignment using Classes/Inheritance/Polymorphism/Exception Handling/Enums) Program specifications (business requirements): Customer bank account enhancements You will be updating the Customer Bank Account Windows application that you created from Assignment #3 with the following enhancements. Program specification: · When the application is first launched the following controls should be disabled. · Buttons- Deposit, Withdrawal, Show Balance, Print Statement · Text boxes - Deposit text box and Withdrawal text box) · The Welcome button allows a user to perform the following functions (Deposit, Withdrawal, Show Balance and Print Statements) after an account has been selected and the required fields (account #, first and last name) have been entered and verified against the UI validation rules. · The Welcome button should validate the required UI fields before enabling the above functionality buttons and fields (Deposit, Withdrawal, Show Balance, Print Statement, Deposit text box and Withdrawal text box). · The Customer Information group should be disabled to prevent the user from selecting or entering another account while doing transactions on a particular account. · The Deposit button should allow a user to enter a deposit for the selected account. · The Withdrawal button should allow a user to take a withdrawal from the selected account. · The Show Balance button should display the show balance information for the selected account in a message box with the following message box options: Title as Meramec On-Line Banking System, Information Icon and the OK button. · The Print Statement button should display the print statement information for the selected account in a message box with the following message box options: Title as Meramec On-Line Banking System, Information Icon and the OK button. · If any other account type other than a Checking or Savings Account is selected then a Message Box should display “Customer > does not have an > account.” · The Exit button should close the form. · The Clear button should perform the following via the ClearUI method: · Clear all UI input fields · Default the account combo box to the default selection · Disable the following buttons and textboxes (Deposit, Withdrawal, Show Balance, Print Statement buttons, Deposit text box and Withdrawal text box). · Enable the Customer Information Group · The form load event should populate the accounts combo box through code via the PopulateComboBox method with the following values: Checking, Savings, Money Market, Certificate of Deposit · The accounts combo box should display the following text as the default selected text on the initial display of the user interface · --- Select an Account --- · The application should use Exception Handling to handle all expected as well as unexpected errors or messages that are thrown by the application. Design constraints (Business objects): · Create a BankAccount class that inherits the IPrintable Interface with the following attributes (properties) and methods (behaviors) · Properties · Account # (Get/Set) of string data type · Firstname (Get/Set) of string data type · Lastname (Get/Set) of string data type · Owner (Get only) – Returns the following for ex. “Account #123 –John Joe” (Make this property virtual so it can be overridden by the sub-class) string data type · Balance (Get only) Decimal data type · 2 Constructors · Default constructor · Constructor to accept an account #, firstname and lastname · Methods · DepositAmount accepts a single decimal parameter with no return type · WithdrawalAmount accepts two parameters (Make this method virtual so it can be overridden by the Checking Account sub-class) with a method return type of bool. · First parameter is of decimal data type for the withdrawal amount · Second parameter is the checking account type enum value which can be Basic or Premier and defined as a nullable type by prefixing the ? in front of the variable name. i.e ?myVar1 · Type of Checking Account (Basic - 0 or Premier - 1) · null parameter. · The return type is a bool condition (flag) that can be used by the checking class to determine if an overdraft fee needs to be charged based on the type of account that was passed in. · If this method returns true then the overdraft fee must be calculated. Note. This is a running total each time the user has an overdraft from a withdrawal if the account is a Premier type. · If this method returns false then no overdraft fee would be calculated. · Create an Interface called IPrintable with the following abstract methods that you must implement and override the default implementation in each inherited class. · PrintStatement() returns a string · ShowBalance() returns a string · Create a CheckingAccount class that inherits from the BankAccount Class · Properties · Owner (Get) – Returns the following “Checking- “ along with the base class owner property. This property should have the attribute of override · AccountType (Get/Set) –CheckingAccountType Enum of Basic or Premier (CheckingAccountType Enum for setting the account type) · OverDraftFee (Get)– Charge $25 for each checking withdrawal that overdraws the account. · NumberofOverdrafts – (Get) Count the number of overdrafts for the CheckingAccount · Method · WithdrawalAmount- accepts one parameter. Make this method with a return type of void. This method will call the base.WithdrawalAmount method and pass in two parameters. · First parameter is of decimal data type for the withdrawal amount · The return bool type is a flag that can be used by the checking class to determine if an overdraft fee needs to be charged based on the type of account that was passed in. **Updated for Spring 2021 · PrintStatement returns a string (Must Override the IPrintable Interface method with the following implementation) Statement Date as of Today’s date for {Owner} Checking Account Balance is $ xx,xxx.xx Amount of OverDraft Fee for the month is $ x,xxx.xx The number of overdrafts for the month is xxxx · ShowBalance returns a string (Must Override the IPrintable Interface method with the following implementation) Customer {Owner} has $x,xxx.xx in Checking Account. · Constructors (You must call the inherited class default constructors since constructors are not inherited automatically using the : > ( ) syntax ) · Default constructor · Constructor to accept an account #, firstname and lastname · Create a CheckingAccountType Enum to represent the various checking account types. Basic = 0, Premier = 1 · Create a SavingsAccount class that inherits from the BankAccount Class · Create a constant decimal called INTEREST and set the default value to 0.02m (represent 2%) · Create a constant decimal called BALANCE_CHECK and set the default value to 100m · Use these two constants in the Add_Interest method in your calculations. · Properties · Owner (Get) – Returns the following “Savings-“ along with the base class owner property. This property should have the attribute of override. · Methods · WithdrawalAmount – accepts one parameter. Make this method with a return type of void. This method will call the base.WithdrawalAmount method and pass in two parameters. · First parameter is of decimal data type for the withdrawal amount · Second parameter will be the value of null **Updated for Spring 2021 · AddInterest – Add 2% interest to the balance only if the balance is greater than $100. Otherwise, no interest should be added to the balance. This returns the amount of interest earned as a decimal value. · PrintStatement returns a string (Must Override the IPrintable Interface method with the following implementation) Statement Date as of Today’s date for {Owner} Savings Account Balance is $ xx,xxx.xx Interest earned for the month is $ xx,xxx.xx Total Savings Account balance including interest earned is $ xx,xxx.xx · ShowBalance returns a string (Must Override the IPrintable Interface method with the following implementation) Customer {Owner} has $x,xxx.xx in Savings Account. · Constructors (You must call the inherited class default constructors since constructors are not inherited automatically using the : > ( ) syntax ) · Default constructor · Constructor to accept an account #, firstname and lastname Design constraints (Business objects rules): · The Banking Account class should implement the following business rules in the Withdrawal Method: · Do not allow withdrawals that are greater than the balance. A new exception should be thrown back to the calling program with the following message. “Insufficient funds. Please enter a smaller amount.” · Do not allow negative withdrawals regardless of account type (checking or saving). A new exception should be thrown back to the calling program with the following message. “No negative withdrawal amounts are allowed. Please enter a valid amount.” · Do not allow more than $300 dollars to be withdrawn at any one time regardless of account type (checking or saving). A new exception should be thrown back to the calling program with the following message. “Your daily maximum withdrawal is $300 dollars or less. Please enter a smaller amount.” · Rules Exceptions: · Allow withdrawals that are greater than the balance for a “Premier” type Checking account only and don’t throw any exceptions. A Boolean private flag should be set to true to indicate an overdraft has occurred and the calling program needs to handle the returned Boolean value accordingly for calculating the overdraft amount and the number of overdrafts. · The Checking Account class should implement the following business rules: · The Account type property should **Default the Account Type as Premier ** · The Override Withdrawal method should perform the following: · This method should test the account type parameter and pass in the appropriate CheckingAccountEnum value (Basic -0 or Premier -1 ) to the inherited base.Withdrawal method along the withdrawal amount. · The return Boolean value from the inherited base.Withdrawal method should be evaluated for “True”. If the returned value is true then the number of overdrafts and overdraftfee should be calculated accordingly. You do not need to do anything if the returned value is “False”. Program validation/Exception Handling: · The application should check to see if a valid account type has been selected from the accounts dropdown list before attempting to proceed. If no account has been selected, the following error message should be displayed, “No account selected. Please select an account.” · The application should validate all the input from the user interface for blank values before attempting to perform a particular action such as adding a deposit or a withdrawal from a particular account. The program should display the validation error messages before proceeding. · If the customer account number or customer name fields are blank, the program should display the appropriate error message “Customer Account Number is blank” or “Customer First Name is blank” or “Customer Last Name is blank” in a message box with the Error icon. · The application should use Exception Handling in all critical aspects of the applications to catch any exceptions that may be thrown by the application or any of its underline business objects Screenshot of User Interface: Sample Test data to validate your design for various scenarios – (D) – Deposit / (W) - Withdrawal Customer Acct # First name Last Name Account Account Type Trans (#1) Trans (#2) Trans
Answered 1 days AfterOct 12, 2021

Answer To: Programming Assignment #4 - 50 points Customer Bank Account Application Enhancements (Windows...

Raja answered on Oct 13 2021
117 Votes
Doan_Assignment3/.vs/Doan_Assignment3/v16/.suo
Doan_Assignment3/App.config





















Doan_Assignment3/BankAccount.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Doan_Assignment3
{
public class BankAccount : IPrintable
{
public string AccountNumber { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public virtual string Owner { get; }
public decimal? Balance { get; }
public BankAccount()
{
}
public BankAccount(string acountNumber, string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
AccountNumber = acountNumber;
Owner = "Account #" + acountNumber + " " + firstName + " " + lastName;
Balance = GetBalanceInfo();
}
private decimal? GetBalanceInfo()
{
return 100;
}
public virtual string PrintStatement()
{
string message = "Statement Date as of Today’s date for " + Owner + " \n" +
"Checking Account Balance is $ " + Balance + " \n" +
"Amount of OverDraft Fee for the month is $ x, xxx.xx \n" +
"The number of overdrafts for the month is xxxx \n";
return message;
}
public virtual string ShowBalance()
{
return "Customer " + FirstName + " " + LastName + " has " + 100 + " in Checking Account";
}
public void DepositAmount(decimal value)
{
try
{
//Save deposite value here
}
catch (Exception)
{
throw new Exception("Deposit ammount is not submitted !! Please try again");
}
}
public bool WithdrawalAmount(decimal withdrawalAmount, CheckingAccountType? checkingAccount)
{
if (checkingAccount != null)
if (CheckingAccountType.Premier == checkingAccount.Value)
{
return true;
}
if (withdrawalAmount < 0)
{
throw new Exception("No negative withdrawal amounts are allowed. Please enter a valid amount.");
}
if (withdrawalAmount > 300)
{
throw new Exception("Your daily maximum withdrawal is $300 dollars or less. Please enter a smaller amount.");
}
if (withdrawalAmount > 400)
{
throw new Exception("Insufficient funds. Please enter a smaller amount.");
}
return false;
}
}
}
Doan_Assignment3/BankForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//Your name: Ngoc Doan
//Description: Customer bank account - Create a Windows application that shows a customer account information
//Date Created: 09/21/2021
namespace Doan_Assignment3
{
public partial class BankForm : Form
{
private string firstName;
private string lastName;
private string accountNumber;
public BankForm()
{
InitializeComponent();
}
//three methods
private void PopulateCombo()
{
AccComBox.Items.Add("--Select an Account Type --");
AccComBox.Items.Add("Checking");
AccComBox.Items.Add("Savings");
AccComBox.Items.Add("Money Market");
AccComBox.Items.Add("Certificate of Deposit ");
AccComBox.SelectedIndex = 0;
}
private void ClearUI()
{
AccComBox.SelectedIndex = 0;
FirstNameTxtBox.Text = "";
LastNameTxtBox.Text = "";
AccountNumber.Text = "";
WithdrawTxtBox.Text = "";
DepositTxtBox.Text = "";
//disable transaction box and the following functions (Deposit, Withdrawal, Show Balance and Print Statements), enable customer box before click welcome button
TransactionBox.Enabled = false;
Deposit.Enabled = false;
Withdraw.Enabled = false;
Balance.Enabled = false;
Print.Enabled = false;
CustomerBox.Enabled = true;
}
//Form_Load events
private void BankAccount_Load(object sender, EventArgs e)
{
PopulateCombo();
//disable transaction box and the following functions (Deposit, Withdrawal, Show Balance and Print Statements) before click welcome button
TransactionBox.Enabled = false;
Deposit.Enabled = false;
Withdraw.Enabled = false;
Balance.Enabled = false;
Print.Enabled = false;
}
// The Welcome button perform the following functions (Deposit, Withdrawal, Show Balance and Print Statements)
// after an account has been selected and the required fields (account #, first and last name) have been entered and verified against the UI validation rules.
private void Welcome_Click(object sender, EventArgs e)
{
try
{
if ((AccComBox.SelectedIndex == 0))
{
MessageBox.Show("No account selected. Please select an account", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (string.IsNullOrEmpty(AccountNumber.Text))
{
MessageBox.Show("Customer Account Number is blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (string.IsNullOrEmpty(FirstNameTxtBox.Text) || string.IsNullOrEmpty(LastNameTxtBox.Text))
{
MessageBox.Show("Cusomter Name is blank.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
var selectedText = AccComBox.SelectedItem.ToString().ToLower();
if (selectedText.ToLower().Equals("checking".ToLower()) || selectedText.ToLower().Equals("savings".ToLower()))
{
EnableUI();
this.firstName = FirstNameTxtBox.Text;
this.lastName = LastNameTxtBox.Text;
this.accountNumber = AccountNumber.Text;
}
else
{
MessageBox.Show("Customer " + FirstNameTxtBox.Text + " " + LastNameTxtBox.Text + " does not have an " + selectedText + " account.");
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void ShowInfoMessage(string message)
{
MessageBox.Show(message, "Meramec On-Line Banking System", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void EnableUI()
{
TransactionBox.Enabled = true;
Deposit.Enabled = true;
Withdraw.Enabled = true;
Balance.Enabled = true;
Print.Enabled = true;
CustomerBox.Enabled = false;
}
private void Deposit_Click(object sender, EventArgs e)
{
try
{
string depositAmmount = DepositTxtBox.Text.ToString();
if (string.IsNullOrEmpty(depositAmmount))
{
MessageBox.Show("Please enter deposit amount");
return;
}
decimal dValue = Convert.ToDecimal(depositAmmount);
var selectedText = AccComBox.SelectedItem.ToString().ToLower();
switch (selectedText)
{
case "checking":
CheckingAccount checkingAccount = new CheckingAccount(accountNumber, firstName, lastName);
checkingAccount.DepositAmount(dValue);
ShowInfoMessage("Ammount deposit successfully");
break;
case "savings":
SavingsAccount savingsAccount = new SavingsAccount(accountNumber, firstName, lastName);
savingsAccount.DepositAmount(dValue);
ShowInfoMessage("Ammount deposit successfully");
break;
default:
break;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void Withdraw_Click(object sender, EventArgs e)
{
try
{
string withdrawalAmmount = WithdrawTxtBox.Text.ToString();
if (string.IsNullOrEmpty(withdrawalAmmount))
{
MessageBox.Show("Please enter withdrawal amount");
return;
}
decimal dValue = Convert.ToDecimal(withdrawalAmmount);
var selectedText = AccComBox.SelectedItem.ToString().ToLower();
switch (selectedText)
{
case "checking":
CheckingAccount checkingAccount = new CheckingAccount(accountNumber, firstName, lastName);
checkingAccount.WithdrawalAmount(dValue);
ShowInfoMessage("Ammount withdrawal successfully");
break;
case "savings":
SavingsAccount savingsAccount = new SavingsAccount(accountNumber, firstName, lastName);
savingsAccount.WithdrawalAmount(dValue);
ShowInfoMessage("Ammount withdrawal successfully");
break;
default:
break;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void Print_Click(object sender, EventArgs e)
{
try
{
var selectedText = AccComBox.SelectedItem.ToString().ToLower();
switch (selectedText)
{
case "checking":
CheckingAccount checkingAccount = new CheckingAccount(accountNumber, firstName, lastName);
ShowInfoMessage(checkingAccount.PrintStatement());
break;
case "savings":
SavingsAccount savingsAccount = new SavingsAccount(accountNumber, firstName, lastName);
ShowInfoMessage(savingsAccount.PrintStatement());
break;
default:
break;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void Clear_Click(object sender, EventArgs e)
{
ClearUI();
}
private void Exit_Click(object sender, EventArgs e)
{
this.Close();
}
private void Balance_Click(object sender, EventArgs e)
{
try
{
var selectedText = AccComBox.SelectedItem.ToString().ToLower();
switch (selectedText)
{
case "checking":
CheckingAccount checkingAccount = new CheckingAccount(accountNumber, firstName, lastName);
ShowInfoMessage(checkingAccount.ShowBalance());
break;
case "savings":
SavingsAccount savingsAccount = new SavingsAccount(accountNumber, firstName, lastName);
ShowInfoMessage(savingsAccount.ShowBalance());
break;
default:
break;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void WithdrawTxtBox_TextChanged(object sender, EventArgs e)
{
}
private void DepositTxtBox_TextChanged(object sender, EventArgs e)
{
}
}
}
Doan_Assignment3/BankForm.Designer.cs
namespace Doan_Assignment3
{
partial class BankForm
{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///

/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.CustomerBox = new System.Windows.Forms.GroupBox();
this.AccountNumber = new System.Windows.Forms.MaskedTextBox();
this.AccComBox = new System.Windows.Forms.ComboBox();
this.LastNameTxtBox = new System.Windows.Forms.TextBox();
this.FirstNameTxtBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.TransactionBox = new System.Windows.Forms.GroupBox();
this.DepositTxtBox = new System.Windows.Forms.TextBox();
this.WithdrawTxtBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.Welcome = new System.Windows.Forms.Button();
this.Exit = new System.Windows.Forms.Button();
this.Clear = new System.Windows.Forms.Button();
this.Print = new System.Windows.Forms.Button();
this.Balance = new System.Windows.Forms.Button();
this.Withdraw = new System.Windows.Forms.Button();
this.Deposit = new System.Windows.Forms.Button();
this.CustomerBox.SuspendLayout();
this.TransactionBox.SuspendLayout();
this.SuspendLayout();
//
// CustomerBox
//
this.CustomerBox.Controls.Add(this.AccountNumber);
this.CustomerBox.Controls.Add(this.AccComBox);
this.CustomerBox.Controls.Add(this.LastNameTxtBox);
this.CustomerBox.Controls.Add(this.FirstNameTxtBox);
this.CustomerBox.Controls.Add(this.label4);
this.CustomerBox.Controls.Add(this.label3);
this.CustomerBox.Controls.Add(this.label2);
this.CustomerBox.Controls.Add(this.label1);
this.CustomerBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here