Advertisement
Kenkaster001

HOA2

Aug 15th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 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 HOA1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string user, password;
  14. Console.Write("Enter acct name: ");
  15. user = Console.ReadLine();
  16. Console.Write("Enter pin: ");
  17. password = Console.ReadLine();
  18. if (user == "user" && password == "1234")
  19. {
  20. int balance, choice;
  21. Console.WriteLine("---------------------------------");
  22. Console.WriteLine("Welcome user!");
  23. Console.Write("Set your initial balance: ");
  24. balance = int.Parse(Console.ReadLine());
  25. Console.WriteLine("Balance: Php " + balance);
  26. Console.WriteLine("---------------------------------");
  27. Console.WriteLine("Choose an option: ");
  28. Console.WriteLine("1 - Deposit");
  29. Console.WriteLine("2 - Withdraw");
  30. Console.Write("Enter choice: ");
  31. choice = int.Parse(Console.ReadLine());
  32. if (choice == 1)
  33. {
  34. int money_add;
  35. Console.WriteLine("---------------------------------");
  36. Console.Write("How much would you want to deposit?: ");
  37. money_add = int.Parse(Console.ReadLine());
  38. balance += money_add;
  39. Console.WriteLine("Your money now is Php" + balance);
  40. Console.ReadKey();
  41. Console.WriteLine("---------------------------------");
  42. }
  43. else if (choice == 2)
  44. {
  45. int withdraw;
  46. Console.WriteLine("---------------------------------");
  47. Console.Write("How much would you want to withdraw?: ");
  48. withdraw = int.Parse(Console.ReadLine());
  49. if (withdraw <= balance)
  50. {
  51. balance -= withdraw;
  52. Console.WriteLine("Your updated balance is: Php " + balance);
  53. Console.ReadKey();
  54. }
  55. else
  56. {
  57. Console.WriteLine("Insufficient funds. . .");
  58. }
  59. Console.WriteLine("---------------------------------");
  60. }
  61. else
  62. {
  63. Console.WriteLine("Invalid transaction!. . .");
  64. }
  65. Console.WriteLine("Your balance is: Php " + balance);
  66. Console.WriteLine("Thank you for banking with us!");
  67. }
  68. Console.ReadKey();
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement