Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp1
- {
- class CreateAccount
- {
- static void Main(string[] args)
- {
- Console.WriteLine("An applicatino modeling the handling of all bank accounts");
- //BankAccount account1 = new BankAccount();
- //BankAccount account2 = new BankAccount();
- //account1.accountType = "Current";
- //account1.accountNumber = 123;
- //account1.accountBalance = 1000.00;
- //Console.WriteLine("Account Number: " + account1.accountNumber);
- //Console.WriteLine("Account Type: " + account1.accountType);
- //Console.WriteLine("Account Balance: " + account1.accountBalance);
- //account1.accountNumber = long.Parse(Console.ReadLine());
- //account2.accountType = "Savings";
- //account2.accountNumber = 124;
- //account2.accountBalance = 2000.00;
- //Console.WriteLine("Account Number: " + account2.accountNumber);
- //Console.WriteLine("Account Type: " + account2.accountType);
- //Console.WriteLine("Account Balance: " + account2.accountBalance);
- BankAccount kowalski = NewBankAccount();
- PrintAccount(kowalski);
- BankAccount nowak = NewBankAccount();
- PrintAccount(nowak);
- }
- static BankAccount NewBankAccount()
- {
- BankAccount newAccount = new BankAccount();
- try
- {
- Console.Write("Enter the account number");
- newAccount.accountNumber = long.Parse(Console.ReadLine());
- Console.Write("Enter the account type: ");
- newAccount.accountType = Console.ReadLine();
- Console.Write("Enter the account balance");
- newAccount.accountBalance = double.Parse(Console.ReadLine());
- }
- catch (System.FormatException e)
- {
- Console.WriteLine("An exeption when reading the keyboard appeared:" + e);
- }
- return newAccount;
- }
- static void PrintAccount(BankAccount account)
- {
- Console.WriteLine("Account number: " + account.accountNumber);
- Console.WriteLine("Account type : " + account.accountType);
- Console.WriteLine("Account balance: " + account.accountBalance);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement