Question

In: Computer Science

must be written in c# using windows forms not console Scenario: Samediff bank has a 25-year...

must be written in c# using windows forms not console

Scenario: Samediff bank has a 25-year old banking account system. It was created using procedural programming. Samediff bank needs to improve the security and maintainability of the system using an object-oriented programming (OOP) approach. Their bank manager has decided to hire you to develop, implement, and test a new OOP application using efficient data structures and programming techniques.Samediff banks manager is excited to consider updating their account system. An expert has advised that they would be able to increase both security and ease of maintenance by using object oriented concepts such as polymorphism.

Create an inheritance hierarchy that a bank will use to represent customers’ bank accounts. All customers of Samediff bank can deposit (i.e., credit) money into their accounts and withdraw (i.e., debit) money from their accounts. Each month they process interest earned and penalties on each account. Specific types of accounts exist. Each type of account you will need to consider in your inheritance hierarchy is listed below.You will need to create a list of accounts, in which you will have different types of accounts. account[] accountslist=new account[10];

account[0]=new savings();

account[1]=new checking();

or List accounts; accounts.add(new checking());

accounts.add(new savings());

You must complete these steps in your code

1. A menu system to add customers and accounts, delete customers and accounts.

2. Print customers with each customers accounts sorted by the last name of each customer.

3. Demonstrate that one customer can have more than one account.

4. Demonstrate a deposit and withdrawal of a customers account balance.

5. Demonstrate earned interest on an account.

6. Demonstrate penalties applied to an account.

Solutions

Expert Solution

Hi hope you are good.

Here is the main program.

using System;

using System.Collections.Generic;

using System.Linq;

namespace BankExcercise

public class Bank

{

public string name;

private List<Account> bankAccounts;

public Bank(sting name)

{

this.name = name;

bankAccounts = new List<Account>();

}

public int OpenBankAccount(Type accountType, decimal startingBalance)

{

int newId = bankAccoiunts.Count();

bankAccounts.Add((Account)Activator.CreateInstance(accountType,newId,startingBalance));

return newId;

}

public Account GetAccount(int ownerId)

{

Account account = bankAccounts.Where(x=>x.owner == ownerId).FirstOrDefault();

if(account == null)

{

throw new ApplicationException("No Account exists with that id");

}

return account;

}

public bool Tranferfunds(int fromAccountId,int toAccountId, decimal transferAmount)

{

if(transferAmount<=0)

{

throw new ApplicationException("transfer amount must be positive");

}

else if (transferAmoiunt ==0)

throw new ApplicationException("Invalid Amount");

}

Account fromAccount = GetAccount(fromAccountId);

Account fromAccount = GetAccount(toAccountId);

if(fromAccount.balance<transferAmount)

{

throw new ApplicationException("Insufficient funds");

}

fromAccount.Transfer(-1*transferAmount,toAccoiuntId);

toAccount.Transfer(transferAmount,fromAccountId);

return true;

}

----------------------------------------------------------------

Abstract an account from which savings and chewckings would derive

using BankExcercise.Transactions;

using System;

using System.Collections.Generic;

namespace BankExcercise

{

public abstract class Account

{

public int owner { get; set;}

public decimal balance (get ; set;)

public List<Transaction> tranactions{get;set;}

public Account(int owner,decimal balance)

{

this.owner = owner;

this.balance = balance;

transactions = new List<Transactions>();

}

public virtual bool Withdrawl(decimal withdrawlAmount)

{

if (balance < withdrawlAmount)

{

throw new ApplicationException("Insufficient funds");

}

else if (withdrawalAmount<=0)

{

throw new ApplicationException("Invalid");

}

balance -=withdrawlAmount;

Transaction newTransaction = new WithdrawlTransaction(withdrawlAmount);

transactions.Add(newTransaction);

return true;

}

public void Transfer(decimal transfferAmount,int transferToId)

{

balance +=transferAmounbt;

TransferTransaction newTransaction = new TransaferTranscation(transferAmount,transferToId,owner)

transactions.Add(newTransaction);}

public void Deposit(decimal amount)

{

if(amount<=0)

{

throw new ApplicationException("Invalid Deposit Amout");

}

balance += amount;

Transaction newTransaction = new DepositTransaction(amount);

transactions.add(newTransaction);

}

}

}

Hope this helps.

You can write class for individual , saving and checkings as mentioned.

Askk me for any queries.


Related Solutions

Must be in Visual C# using windows forms : Create an application that opens a specified...
Must be in Visual C# using windows forms : Create an application that opens a specified text file and then displays a list of all the unique words found in the file. Hint: Use a LINQ method to remove all duplicate words.
***IN C# ONLY, USING WINDOWS FORMS*** --NO JAVA--. Create a GUI application in C# that calculates...
***IN C# ONLY, USING WINDOWS FORMS*** --NO JAVA--. Create a GUI application in C# that calculates and displays the total travel expenses of a business person on a trip. Here is the information that the user must provide: • Number of days on the trip • Amount of airfare, if any • Amount of car rental fees, if any • Number of miles driven, if a private vehicle was used • Amount of parking fees, if any • Amount of...
Must be in C#: 7. E-MAIL ADDRESS BOOK Create a Windows Forms Application with a class...
Must be in C#: 7. E-MAIL ADDRESS BOOK Create a Windows Forms Application with a class named PersonEntry. The PersonEntry class should have properties for a person’s name, e-mail address, and phone number. Also, create a text file that contains the names, e-mail addresses, and phone numbers for at least five people. When the application starts, it should read the data from the file and create a PersonEntry object for each person’s data. The PersonEntry objects should be added to...
Create a C# Windows Console application that displays the following patterns separately, one after the other....
Create a C# Windows Console application that displays the following patterns separately, one after the other. You MUST use nested for loops to generate the patterns. All asterisks (*) should be displayed by a single statement of the form Console.Write("*"); which causes the asterisks to display side by side. A statement of the form Console.WriteLine(); can be used to move to the next line. A statement of the form Console.Write(" "); can be used to display a space for the...
How to make an application for windows using c# ?
How to make an application for windows using c# ?
The following code must be written using matlab and must be using a for-loop. NOTE! Write...
The following code must be written using matlab and must be using a for-loop. NOTE! Write a computer program that assigns random integers for each entry and generates a row vector. Different random integers should be drawn from different intervals for position 1, position 2, position3 and position 4 of the array. After these first 4 positions are drawn. The whole thing should start over where position5 drawn from same interval as positions 1, position6 drawn from same interval as...
The following code must be written using matlab and must be using a for-loop. NOTE! Write...
The following code must be written using matlab and must be using a for-loop. NOTE! Write a computer program that assigns random integers for each entry and generates a row vector. Different random integers should be drawn from different intervals in chunks of 4 , that is chunk1-chunk2-chunk3-chunk4 The parameters for specifying the lintervals by which the random numbers should be drawn should be able to change and be hardcoded in the script, however, be hardcoded in the script.
Needs to be written in C# Console App! Create a base class BankAccount. Decide what characteristics...
Needs to be written in C# Console App! Create a base class BankAccount. Decide what characteristics are common for checking and saving accounts and include these characteristics in the base class. Define derived classes for checking and savings. In your design , do not allow the banking base account to be instantiated --only the checking and saving classes. Use a Program class to test your design.
I need the c# code for the below assignment. Complete PigLatin program in Windows Forms GUI....
I need the c# code for the below assignment. Complete PigLatin program in Windows Forms GUI. Zip the solution project file and attach to this submission. Do this in the GUI format (Windows Form). Be sure and add a Clear Button to reset for entering another word or words. PigLatinGUI Basic Steps in Creating your Program Create your user interface (GUI). Use different font styles but don’t overdo it, Use colors, and Use graphics (You can find all kinds of...
answer the following using C# Design and program a Visual Studio Console project in C# that...
answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT