Pass Task 7.1- Abstract Transactions.docx - SIT232 Object Oriented Development Ontrack Submission Pass Task 7.1 Abstract Transactions Purusharth

Pass Task 7.1- Abstract Transactions.docx - SIT232 Object...

This preview shows page 1 - 5 out of 14 pages.

SIT232: Object Oriented Development Ontrack Submission Pass Task 7.1: Abstract Transactions Purusharth Malhotra malhotrap
Image of page 1
P ROGRAM . CS using System; using BankApplication; public enum MenuOption { Withdraw, Deposit, Print, transfer, NewAccount, PrintTransaction, Quit, } public class Program { private static MenuOption ReadUserOption() { int option; string inputText; do { Console .WriteLine( "Choose an option [1-7]: " ); inputText = Console .ReadLine(); option = Convert .ToInt32(inputText); } while (option < 1 || option > 7 ); return ( MenuOption )(option - 1 ); } private static void DoWithdraw( Bank toBank) { // decimal myDecimal; // do // { // Console.WriteLine("How much would you like to withdraw?"); // myDecimal = Convert.ToDecimal(Console.ReadLine()); // account._balance -= myDecimal;
Image of page 2
// } while( myDecimal < 0 ); // WithdrawTransaction WithdrawTransaction = new WithdrawTransact ion(account, myDecimal); // WithdrawTransaction.Execute(); // WithdrawTransaction.Print(); string inputText; decimal myDecimal; Account toAccount = FindAccount(toBank); if (toAccount == null ) return ; Console .WriteLine( "How much would you like to withdraw?" ); inputText = Console .ReadLine(); myDecimal = Convert .ToDecimal(inputText); WithdrawTransaction WithdrawTransaction = new WithdrawTransactio n (toAccount, myDecimal); toBank.ExecuteTransaction(WithdrawTransaction); WithdrawTransaction.Print(); } private static void DoTransfer( Bank BankNo1) { Decimal AmountToBeTransferred; string inputText; Console .WriteLine( "Please Amount to be tranferred" ); inputText = Console .ReadLine(); AmountToBeTransferred = Convert .ToDecimal(inputText); Console .WriteLine( "for Withdrawl" ); Account _FromAccount = FindAccount(BankNo1); Console .WriteLine( "for Deposite" ); Account _toAccount = FindAccount(BankNo1); TransferTransaction TransferObject = new TransferTransaction (_FromA ccount, _toAccount, AmountToBeTransferred; TransferObject.Execute(); TransferObject.Print(); }
Image of page 3
private static void DoDeposit( Bank toBank) { string inputText; decimal myDecimal; Account toAccount = FindAccount(toBank); if (toAccount == null ) return ; Console .WriteLine( "How much would you like to deposit?" ); inputText = Console .ReadLine(); myDecimal = Convert .ToDecimal(inputText); DepositTransaction transaction = new DepositTransaction (toAccount, myDecimal); toBank.ExecuteTransaction(transaction); transaction.Print(); }
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 14 pages?

  • '19
  • Return statement, Void type, Virtual inheritance, new Bank, public enum MenuOption, Purusharth Malhotra

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture