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; } }
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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;
}
}

Transcribed Image Text:PS E:\stef C# homework\New folder> dotnet "C:\Users\stefa\AppData\Roaming\Code\User\cs-script.user\dotnet\cscs.dll" "e:\stef C# homework\New folder\Bank.cs"
Error: Specified file could not be compiled.
e:\stef C# homework\New folder\Bank.cs(12,28): error CS0246: The type or namespace name 'BankAccount' could not be found (are you missing a using directive or an assembly reference?)
e:\stef C# homework\New folder\Bank.cs(26,12): error CS0246: The type or namespace name 'BankAccount' could not be found (are you missing a using directive or an assembly reference?)
e:\stef C# homework\New folder\Bank.cs(5,18): error CS0246: The type or namespace name 'BankAccount' could not be found (are you missing a using directive or an assembly reference?)
e:\stef C# homework\New folder\Bank.cs(12,28): error CS0246: The type or namespace name 'BankAccount' could not be found (are you missing a using directive or an assembly reference?)
e:\stef C# homework\New folder\Bank.cs(26,12): error CS0246: The type or namespace name 'BankAccount could not be found (are you missing a using directive or an assembly reference?)
e:\stef C# homework\New folder\Bank.cs(5,18): error CS0246: The type or namespace name 'BankAccount' could not be found (are you missing a using directive or an assembly reference?)
PS E:\stef C# homework\New folder>
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

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education