Question: C# - Bank Mashup Application Create Account class Implement private fields with public setters and getters in the Account class AccountNumber - should allow only

C# - Bank Mashup Application

Create Account class

Implement private fields with public setters and getters in the Account class

AccountNumber - should allow only for 20 digits, including leading zeros, but NO LETTERS - example value: "00045678493857683928". Your setter should set empty if validation fails. - "Numbers" allowing for leading zeros are really just strings. If less than 20 digits or more than 20 digits set to empty string

AccountType - "Savings" or "Checking" - no other types or string should be accepted in this setter. If I pass "MoneyMarket" the setter should default this property to empty. Casing can be ignored - for example, "SAVINGS" and "savings" can be accepted. I will accept strings but can also be enum.

AccountBalance - How much money is in the account. Balance should never be less than zero. If your setter allows for setting a value less than zero you will lose points. You should check the value first, and if it is less than zero, just set the balance to zero.

Implement the following public methods (behaviors) in the Account class:

Default constructor - no arguments but the properties are initialized to non-null values.

Parameterized constructor - arguments for all properties can be passed (AccountNumber, AccountType, AccountBalance)

ToString - return a formatted string with labels for each of the following: account number, account type, and balance. AccountBalance should be formatted with a $ and decimals. This should be in a single string on 1 line.

- ex: "Account number: 11111111111111111111 Account type: Checking Account Balance: $500.00"

Equals - accept an object as a parameter, cast it to an Account type, and compare the following

- Whether the Account number, Account type, and Account balance match. If they match return true, else return false

- Ignore mixed casing on Account type - Use ToUpper or ToLower to ignore casing

"CHECKING" should match "checking", etc.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!