in C# i need to my errors are in the pic Create a Bank class with the following properties: List of bank accounts (List) Create the following methods in the Bank class: AddAccount(BankAccount account): Method to add a new bank account to the list of accounts RemoveAccount(string accountNumber): Method to remove an existing bank account from the list of accounts SearchAccount(string accountNumber): Method to search for an existing bank account and return the account details my code is using System.Collections.Generic; public class Bank { private List accounts; public Bank() { accounts = new List(); } public void AddAccount(BankAccount account) { accounts.Add(account); } public void RemoveAccount(string accountNumber) { BankAccount account = SearchAccount(accountNumber); if (account != null) { accounts.Remove(account); } } public BankAccount SearchAccount(string accountNumber) { foreach (BankAccount account in accounts) { if (account.AccountNumber == accountNumber) { return account; } } return null; } }
in C# i need to my errors are in the pic Create a Bank class with the following properties: List of bank accounts (List) Create the following methods in the Bank class: AddAccount(BankAccount account): Method to add a new bank account to the list of accounts RemoveAccount(string accountNumber): Method to remove an existing bank account from the list of accounts SearchAccount(string accountNumber): Method to search for an existing bank account and return the account details my code is using System.Collections.Generic; public class Bank { private List accounts; public Bank() { accounts = new List(); } public void AddAccount(BankAccount account) { accounts.Add(account); } public void RemoveAccount(string accountNumber) { BankAccount account = SearchAccount(accountNumber); if (account != null) { accounts.Remove(account); } } public BankAccount SearchAccount(string accountNumber) { foreach (BankAccount account in accounts) { if (account.AccountNumber == accountNumber) { return account; } } return null; } }
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter9: Sequential Access Files And Menus
Section: Chapter Questions
Problem 4E
Related questions
Question
in C# i need to
my errors are in the pic
-
Create a Bank class with the following properties:
- List of bank accounts (List<BankAccount>)
-
Create the following methods in the Bank class:
- AddAccount(BankAccount account): Method to add a new bank account to the list of accounts
- RemoveAccount(string accountNumber): Method to remove an existing bank account from the list of accounts
- SearchAccount(string accountNumber): Method to search for an existing bank account and return the account details
my code is
using System.Collections.Generic;
public class Bank
{
private List<BankAccount> accounts;
public Bank()
{
accounts = new List<BankAccount>();
}
public void AddAccount(BankAccount account)
{
accounts.Add(account);
}
public void RemoveAccount(string accountNumber)
{
BankAccount account = SearchAccount(accountNumber);
if (account != null)
{
accounts.Remove(account);
}
}
public BankAccount SearchAccount(string accountNumber)
{
foreach (BankAccount account in accounts)
{
if (account.AccountNumber == accountNumber)
{
return account;
}
}
return null;
}
}
Expert Solution
Step 1
Solution:
- This error is showing because "BankAccount" class isn't implemented by you.
- Here I am attaching complete program with "BankAccount" class and Tester class.
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,