Created
January 30, 2017 22:10
-
-
Save nummi/b05ae2e244a6949a2c4d20d7a307bda4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Accounts { | |
| public double Balance { | |
| get { return balance; } | |
| set { balance = value; } | |
| } | |
| public double Withdrawl { | |
| get { return withdrawl; } | |
| set { withdrawl = value; } | |
| } | |
| public int AccountNumber { | |
| get { return accountNumber; } | |
| set { accountNumber = value; } | |
| } | |
| public string DisplayWithdrawSuccessMessage() { | |
| Console.WriteLine("You have withdrawn $" + this.withdrawal + " from account number " + this.accountNumber + " at " + DateTime.Now); | |
| Console.WriteLine(this.AccountBalanceMessage()); | |
| } | |
| public void LogWithdrawTransaction() { | |
| StreamWriter transactions = new StreamWriter(this.accountName + ".txt", true); | |
| transactions.Write(this.firstName + " " + this.lastName + " Client Account #" + this.clientNumber + " "); | |
| transactions.Write(this.accountName + " Account#" + this.accountNumber + " Withdraw Amount: -$" + this.withdrawal); | |
| transactions.WriteLine(" New Current Balance: $" + this.balance + " " + DateTime.Now); | |
| transactions.Close(); | |
| } | |
| public virtual void Withdraw() { | |
| Console.Clear(); | |
| Console.WriteLine("How much would you like to withdraw from your + this.accountName +?"); | |
| this.withdrawal = double.Parse(Console.ReadLine()); | |
| this.balance -= this.withdrawal; | |
| Console.Clear(); | |
| this.DisplayWithdrawSuccessMessage(); | |
| this.LogWithdrawTransaction(); | |
| Console.WriteLine(this.firstName + ", your transaction has been processed. \n"); | |
| } | |
| } | |
| class SavingsAccount : Accounts { | |
| public int AccountName { | |
| get { return "savings"; } | |
| } | |
| public string AccountBalanceMessage() { | |
| return "Your savings account balance is $" + this.balance + "."; | |
| } | |
| } | |
| class ReserveAccount : Accounts { | |
| public int AccountName { | |
| get { return "reserve"; } | |
| } | |
| public string AccountBalanceMessage() { | |
| return "Your reserve account balance is $" + this.balance + "."; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment