Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.47 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Assignment2_4
  8. {
  9.     class Program
  10.     {
  11.        
  12.  
  13.  
  14.         static void Main(string[] args)
  15.         {
  16.             int choice;
  17.             string[] name = new string[2];
  18.             name[0]="User";
  19.             name[1]="User1";
  20.             name[2]="User2";
  21.             BankAccount User = new BankAccount();
  22.             BankAccount User1 = new BankAccount();
  23.             BankAccount User2 = new BankAccount();
  24.             User.BankAccountConstruct();
  25.             User1.BankAccountConstruct();
  26.             User2.BankAccountConstruct();
  27.             Console.WriteLine("Which account do you want to manipulate with?(0/1/2");
  28.             choice = int.Parse(Console.ReadLine());
  29.            
  30.  
  31.             bool wdcontinue=true;
  32.             string check="";
  33.            
  34.             while (wdcontinue==true)
  35.             {
  36.  
  37.                 bool truth = false;
  38.  
  39.             while (truth == false)
  40.             {
  41.  
  42.                 Console.WriteLine("Do you want to deposit or withdraw money?(d/w)");
  43.                 check=Console.ReadLine();
  44.                 if (check == "d" || check == "w")
  45.                 { truth = true; }
  46.  
  47.                 else
  48.  
  49.                 { Console.WriteLine("You have selected invalid option"); }
  50.            
  51.             }
  52.  
  53.  
  54.             if (check == "d")
  55.             {
  56.                 Console.WriteLine("How much do you want to deposit?");
  57.                 decimal deposit = Convert.ToDecimal(Console.ReadLine());
  58.                 name[choice].Deposit(deposit);
  59.             }
  60.             else if (check=="w")
  61.             {
  62.                 Console.WriteLine("How much do you want to withdraw?");
  63.                 decimal deposit = Convert.ToDecimal(Console.ReadLine());
  64.                 name[choice].WithDraw(deposit);
  65.             }
  66.  
  67.  
  68.             User.ShowInfo();
  69.             string answer = "";
  70.             bool inputyn = false;
  71.  
  72.             while (inputyn == false)
  73.             {
  74.                 Console.WriteLine("Do you whish to continue?(y/n)");
  75.                 answer = Console.ReadLine();
  76.                 if (answer == "n") { wdcontinue = false; inputyn = true; }
  77.                 else if (answer == "y") { wdcontinue = true; inputyn = true; }
  78.                 else
  79.                 {
  80.                     Console.WriteLine("bad answer");
  81.                 }
  82.             }
  83.             }
  84.  
  85.  
  86.         }
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement