nucLeaRsc2

C# Lab 7 Problema 2

Nov 16th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. //Acc number e unic (incrementat automat incepand cu 123)
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7.  
  8. namespace SuportLaborator7
  9. {
  10. public enum AccountType { Cec, Deposit }
  11. public class BankAccount
  12. {
  13. private AccountType accType;
  14. private long accNumber;
  15. private decimal amount;
  16. private static long succNrCont=122;
  17. public void PopulareCampuri(decimal sold, AccountType tip)
  18. {
  19. accType = tip;
  20. accNumber = NextNumber();
  21. amount = sold;
  22. }
  23. public long NumarCont()
  24. {
  25. return accNumber;
  26. }
  27. public decimal Sold()
  28. {
  29. return amount;
  30. }
  31. public AccountType ReturnTipCont()
  32. {
  33. return accType;
  34. }
  35. static private long NextNumber()
  36. {
  37. succNrCont++;
  38. return succNrCont;
  39. }
  40. }
  41.  
  42. class Program
  43. {
  44. static void Main(string[] args)
  45. {
  46. BankAccount account = new BankAccount();
  47.  
  48. BankAccount obj = new BankAccount();
  49. //long x = long.Parse(Console.ReadLine());
  50. //while (obj.NumarCont() <= 150)
  51. //{
  52. obj.PopulareCampuri(3.5M, AccountType.Deposit);
  53.  
  54. Console.WriteLine("Contul meu are numarul {0}, este de tip {1} si are o suma de {2}",
  55. obj.NumarCont(), obj.ReturnTipCont(), obj.Sold());
  56. //}
  57. Console.ReadKey();
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment