Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Create a base class for a banking account. Decide what characteristics are common for checking and saving accounts and include these characteristics in the base class. Define subclasses for checking...

1 answer below »

Create a base class for a banking account. Decide what characteristics are common for checking and saving accounts and include these characteristics in the base class. Define subclasses for checking and savings. In your design, do not allow the banking base account to be instantiated— only the checking and saving subclasses. Include a presentation class to test your design.

Answered Same Day Jun 22, 2021

Solution

Aditya answered on Jun 24 2021
139 Votes
WindowsFormsApp1/App.config




WindowsFormsApp1
anking_account.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApp1
{
public class banking_account
{
private int accNumber;
private string accName;
private DateTime dateOfBirth;
private long cutomerMobNo;
private string
anchName;
public banking_account(int accNumber, string accName, DateTime dateOfBirth, long cutomerMobNo, string
anchName)
{
this.accNumber = accNumber;
this.accName = accName;
this.dateOfBirth = dateOfBirth;
this.cutomerMobNo = cutomerMobNo;
this.
anchName =
anchName;
}
public banking_account()
{
}
public int getAccNumber()
{
return this.accNumber;
}
public string getAccName()
{
return this.accName;
}
public DateTime getDateOfBirth()
{
return this.dateOfBirth;
}
public long getCutomerMobNo()
{
return this.cutomerMobNo;
}
public string getBranchName()
{
return this.
anchName;
}
public void setAccNumber(int temp)
{
this.accNumber = temp;
}
public void setAccName(string temp)
{
this.accName = temp;
}
public void setDateOfBirth(DateTime temp)
{
this.dateOfBirth = temp;
}
public void setCutomerMobNo(long temp)
{
this.cutomerMobNo = temp;
}
public void setBranchName(string temp)
{
this.
anchName = temp;
}
}
public class checking : banking_account
{
private double withdawLimit;
private double minBal;
private double interest;
public checking(int accNumber, string accName, DateTime dateOfBirth, long cutomerMobNo, string
anchName)
: base(accNumber, accName, dateOfBirth, cutomerMobNo,
anchName)
{
this.withdawLimit = 1000;
this.minBal = 500;
this.interest = 5;
}
public checking()
: base()
{
this.withdawLimit = 1000;
this.minBal = 500;
this.interest = 5;
}
public double getInterest()
{
return this.interest;
}
public double getWithdawLimit()
{
return this.withdawLimit;
}
public double getMinBal()
{
return this.minBal;
}
}
public class saving : banking_account
{
private double withdawLimit;
private double minBal;
private double interest;
public saving(int accNumber, string accName, DateTime dateOfBirth, long cutomerMobNo, string
anchName)
: base(accNumber, accName, dateOfBirth, cutomerMobNo,
anchName)
{
this.withdawLimit = 5000;
this.minBal = 2000;
this.interest = 7.5;
}
public saving():base()
{
this.withdawLimit = 5000;
this.minBal = 2000;
this.interest = 7.5;
}
public double getInterest()
{
return this.interest;
}
public double getWithdawLimit()
{
return this.withdawLimit;
}
public double getMinBal()
{
return this.minBal;
}
}
}
WindowsFormsApp1
in/Debug/WindowsFormsApp1.exe
WindowsFormsApp1
in/Debug/WindowsFormsApp1.exe.config




WindowsFormsApp1
in/Debug/WindowsFormsApp1.pd
WindowsFormsApp1
in/Debug/WindowsFormsApp1.vshost.exe
WindowsFormsApp1
in/Debug/WindowsFormsApp1.vshost.exe.config




WindowsFormsApp1/disp.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;
namespace WindowsFormsApp1
{
public partial class disp : Form
{
int ccount ;
int scount;
checking cObj = new checking();
saving sObj = new saving();
public disp(int sc, int cc, saving s, checking c)
{
InitializeComponent();
scount = sc;
ccount = cc;
sObj = s;
cObj = c;
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label6_Click(object sender, EventArgs e)
{
}
private void AccDisplay_Click(object sender, EventArgs e)
{

if(AccSaving.Checked==true)
{
if(scount==1)
{
AccBranch.Text = sObj.getBranchName();
AccName.Text = sObj.getAccName();
AccNumber.Text = Convert.ToString(sObj.getAccNumber());
AccMobile.Text = Convert.ToString(sObj.getCutomerMobNo());
AccDate.Text = Convert.ToString(sObj.getDateOfBirth().ToString("d"));
}
else
{
MessageBox.Show("No Record Found");
}
}
else
{
if (ccount ==1)
{
AccBranch.Text = cObj.getBranchName();
AccName.Text = cObj.getAccName();
AccNumber.Text = Convert.ToString(cObj.getAccNumber());
AccMobile.Text = Convert.ToString(cObj.getCutomerMobNo());
AccDate.Text = Convert.ToString(cObj.getDateOfBirth().ToString("d"));
}
else
{
MessageBox.Show("No Record Found");
}
}
}
private void disp_Load(object sender, EventArgs e)
{
}
}
}
WindowsFormsApp1/disp.Designer.cs
namespace WindowsFormsApp1
{
partial class disp
{


Required designer variable.


summary
private System.ComponentModel.IContainer components = null;


Clean up any resources being used.


summary

true if managed resources should be disposed; otherwise, false.
param
protected ove
ide 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.


summary
private void InitializeComponent()
{
this.AccDisplay = new System.Windows.Forms.Button();
this.AccMobile = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.AccChecking = new System.Windows.Forms.RadioButton();
this.AccSaving = new System.Windows.Forms.RadioButton();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.AccBranch = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.AccNumber = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.AccName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.AccDate = new System.Windows.Forms.TextBox();
this.SuspendLayout();



AccDisplay


this.AccDisplay.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
this.AccDisplay.Location = new System.Drawing.Point(290, 105);
this.AccDisplay.Name = "AccDisplay";
this.AccDisplay.Size = new System.Drawing.Size(112, 36);
this.AccDisplay.TabIndex = 29;
this.AccDisplay.Text = "Display Account";
this.AccDisplay.UseVisualStyleBackColor = false;
this.AccDisplay.Click += new System.EventHandler(this.AccDisplay_Click);



AccMobile


this.AccMobile.Location = new System.Drawing.Point(359, 299);
this.AccMobile.Name = "AccMobile";
this.AccMobile.Size = new System.Drawing.Size(137, 20);
this.AccMobile.TabIndex = 28;



label7


this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(170, 302);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(58, 13);
this.label7.TabIndex = 27;
this.label7.Text = "Mobile No.";



AccChecking


this.AccChecking.AutoSize = true;
this.AccChecking.Location = new System.Drawing.Point(426, 54);
this.AccChecking.Name = "AccChecking";
this.AccChecking.Size = new System.Drawing.Size(70, 17);
this.AccChecking.TabIndex = 26;
this.AccChecking.Text = "Checking";
this.AccChecking.UseVisualStyleBackColor = true;



AccSaving


this.AccSaving.AutoSize = true;
this.AccSaving.Checked = true;
this.AccSaving.Location = new System.Drawing.Point(339, 54);
this.AccSaving.Name = "AccSaving";
this.AccSaving.Size = new System.Drawing.Size(63, 17);
this.AccSaving.TabIndex = 25;
this.AccSaving.TabStop = true;
this.AccSaving.Text = "Savings";
this.AccSaving.UseVisualStyleBackColor = true;



label6


this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(198, 58);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(74, 13);
this.label6.TabIndex = 24;
this.label6.Text = "Account Type";
this.label6.Click += new System.EventHandler(this.label6_Click);



label5


this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(170, 345);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(68, 13);
this.label5.TabIndex = 23;
this.label5.Text = "Date Of Birth";



AccBranch


this.AccBranch.Location = new System.Drawing.Point(359, 258);
this.AccBranch.Name = "AccBranch";
this.AccBranch.Size = new System.Drawing.Size(137, 20);
this.AccBranch.TabIndex = 22;



label4


this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(170, 261);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 13);
this.label4.TabIndex = 21;
this.label4.Text = "Branch";



AccNumbe


this.AccNumber.Location = new System.Drawing.Point(359, 222);
this.AccNumber.Name = "AccNumber";
this.AccNumber.Size = new System.Drawing.Size(137, 20);
this.AccNumber.TabIndex = 20;



label3


this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(170, 225);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(87, 13);
this.label3.TabIndex = 19;
this.label3.Text = "Account Number";



AccName


this.AccName.Location = new System.Drawing.Point(359, 184);
this.AccName.Name = "AccName";
this.AccName.Size = new System.Drawing.Size(137, 20);
this.AccName.TabIndex = 18;



label2


this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(170, 187);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(124, 13);
this.label2.TabIndex = 17;
this.label2.Text = "Name of Account Holder";



label1


this.label1.AutoSize = true;
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here