Guest User

Untitled

a guest
Jul 17th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public void AdicionarCliente(String nome, String sobrenome)
  2. {
  3. Clientes.Add(new Cliente(nome, sobrenome));
  4. }
  5.  
  6. public sealed class Banco
  7. {
  8. private static readonly Banco instance = new Banco();
  9. public static Banco Instance
  10. {
  11. get
  12. {
  13. return instance;
  14. }
  15. }
  16.  
  17. private List<Cliente> Clientes;
  18.  
  19. private Banco()
  20. {
  21. }
  22.  
  23. public void AdicionarCliente(String nome, String sobrenome)
  24. {
  25. Clientes.Add(new Cliente(nome, sobrenome));
  26. }
  27.  
  28. public int GetNumeroDeClientes()
  29. {
  30. return Clientes.Count;
  31. }
  32.  
  33. public Cliente GetCliente(int indice)
  34. {
  35. return Clientes[indice];
  36. }
  37.  
  38. }
  39.  
  40. public class Cliente
  41. {
  42. public String Nome
  43. {
  44. get;
  45. private set;
  46. }
  47. public String Sobrenome
  48. {
  49. get;
  50. private set;
  51. }
  52. private List<Conta> Contas { set; get; }
  53.  
  54. public Cliente(String nome, String sobrenome)
  55. {
  56. this.Nome = nome;
  57. this.Sobrenome = sobrenome;
  58. }
  59.  
  60. public Conta GetConta(int indice)
  61. {
  62. return Contas[indice];
  63. }
  64.  
  65. public int GetNumeroDeContas()
  66. {
  67. return Contas.Count;
  68. }
  69.  
  70. public void AdicionarConta(Conta c)
  71. {
  72. Contas.Add(c);
  73. }
  74.  
  75. }
Add Comment
Please, Sign In to add comment