-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
133 lines (106 loc) · 2.88 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using System;
using System.Collections.Generic;
namespace Pelicula
{
class Actor
{
public String nombre;
public Int16 año;
public Actor(String nombre,Int16 año)
{
this.nombre=nombre;
this.año=año;
}
}
class Pelicula
{
private String titulo;
private Int16 año;
private String pais;
private String director;
private List<Actor> actores =new List<Actor>();
public void SetTitulo(String titulo)
{
this.titulo=titulo;
}
public String GetTitulo()
{
return this.titulo;
}
public void SetAño(Int16 año)
{
this.año=año;
}
public Int16 GetAño()
{
return this.año;
}
public void SetPais(String pais)
{
this.pais=pais;
}
public String GetPais()
{
return this.pais;
}
public void SetDirector(String director)
{
this.director=director;
}
public String GetDirector()
{
return this.director;
}
public Pelicula()
{
}
public Pelicula(String titulo,Int16 año,String pais,String director)
{
this.titulo=titulo;
this.año=año;
this.pais=pais;
this.director=director;
}
public void Imprime()
{
Console.WriteLine("{0}({1}){2},{3}", this.titulo, this.año,this.pais,this.director);
}
public void AgregarActor(Actor actor)
{
actores.Add(actor);
}
public void ImprimeActores()
{
foreach(Actor act in actores)
{
Console.WriteLine("{0},{1}",act.nombre,act.año);
}
}
}
class Program
{
static void Main()
{
Pelicula P1 = new Pelicula();
Pelicula P2 = new Pelicula();
P1.SetTitulo("Titanic:");
P1.SetAño(1997);
P1.SetPais("Estados Unidos");
P1.SetDirector("James Cameron");
P2.SetTitulo("El Señor de los Anillos: el retorno del Rey:");
P2.SetAño(2003);
P2.SetPais("Nueva Zelanda");
P2.SetDirector("Peter Jackson");
P1.AgregarActor(new Actor("Leonardo Dicaprio",1974));
P2.AgregarActor(new Actor("Elijah Woods",1981));
P1.Imprime();
P1.ImprimeActores();
P2.Imprime();
P2.ImprimeActores();
//Console.WriteLine(P1.GetTitulo()+P1.GetAño()+P1.GetPais()+P1.GetDirector());
//Console.WriteLine(P2.GetTitulo()+P2.GetAño()+P2.GetPais()+P2.GetDirector());
//Console.WriteLine("{0}({1}){2},{3}", P1.GetTitulo(), P1.GetAño(),P1.GetPais(),P1.GetDirector());
//Console.WriteLine("{0}({1}){2},{3}", P2.GetTitulo(), P2.GetAño(),P2.GetPais(),P2.GetDirector());
}
}
}