Do the following tasks:

Task 1
Create an enumerated type named AccountType for representing different types of bank accounts (checking and savings). You will create two variables by using this enum type, and set the values of the variables to Checking and Deposit.


Task 2
Design a class named BankAccount that includes the following members:
• A string value contains account number.
• A decimal value contains account balance.
• An AccountType variable contains account type. AccountType is enumeration that is defined in the previous task.
• Populate() method to set value for each instance variable. This method will return void and expect two parameters: a string (the account number) and a decimal (the account balance). The accType field will be set to AccountType.Checking.
• Properties to get value of each instance variable.
• Withdraw() method will take a decimal parameter and will deduct the given amount from the balance. However, it will check first to ensure that sufficient funds are available, since accounts are not allowed to become overdrawn. It will return a bool value indicating whether the withdrawal was successful.
• Deposit() method will also take a decimal parameter whose value it will add to the balance in the account. It will return the new value of the balance.

Task 3
Create a class named CreateAccount that includes the following static methods:
• NewBankAccount() returns a new instance of BankAccount class. The method will write a prompt to the console prompting the user for the account number and account balance, and then call the Populate() method, passing the account number and account balance as arguments.
• Write() displays information of a BankAccount object. This method will return void and expect one parameter: a BankAccount object.
• TestWithdraw() returns void and expect a BankAccount parameter. The method will write a prompt to the console prompting the user for the amount to withdraw, capture the entered value amount as a decimal, and then call the Withdraw() method on the BankAccount parameter, passing the amount as an argument. The method will capture the bool result returned by Withdraw and write a message to the console if the withdrawal failed.
• TestDeposit() returns void and expect a BankAccount parameter. The method will write a prompt to the console prompting the user for the amount to deposit, capture the entered amount as a decimal, and then call the Deposit() method on the BankAccount parameter, passing the amount as an argument.

Using the following Main() method to test your tasks.
BankAccount berts = CreateAccount.NewBankAccount();
CreateAccount.Write(berts);
Console.WriteLine();
CreateAccount.TestDeposit(berts);
CreateAccount.TestWithdraw(berts);
Console.ReadLine();


Thanks so much !

Recommended Answers

All 4 Replies

Hi, dujdaran, welcome!
We are all friendly girls and boys overhere, but I think nobody of them is prepared to do your homework for you.
Show some effort first, if yoy have some problems on the way, we will try to help. :)

Hi dujdaran,

Keeping ur homework, especially one u aren't very good with, to the last minute is bad practice. Try to get something 'reasonable' done first, post it, the problem u're having and we're willing to help. Be sure to read the rules too... ;-)

Regards,

Seslie.

Hey dujgaran,

I suggest you to work on each module from starting and when some problem comes, you may post again.Please consider me not being rude because I want to help you in a better way by solving your problem and not the whole question.
That's how everything works until you put some efforts by yourself.

Lol here is a start for Task 2

class BankAccount

hope it helps;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.