C# e Orientação a Objetos
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
RESPOSTAS 166<br />
14<br />
15 System . Console . WriteLine (f1. nome );<br />
16 System . Console . WriteLine (f1. cargo );<br />
17 System . Console . WriteLine (f1. salario );<br />
18<br />
19 System . Console . WriteLine (f2. nome );<br />
20 System . Console . WriteLine (f2. cargo );<br />
21 System . Console . WriteLine (f2. salario );<br />
22 }<br />
23 }<br />
Código <strong>C#</strong> 3.23: TestaFuncionario.cs<br />
Resposta do Exercise 3.5<br />
Adicione o seguinte arquivo na pasta orientacao-a-objetos.<br />
1 class Turma<br />
2 {<br />
3 public string periodo ;<br />
4 public int serie ;<br />
5 public string sigla ;<br />
6 public string tipoDeEnsino ;<br />
7 }<br />
Código <strong>C#</strong> 3.24: Turma.cs<br />
Resposta do Exercise 3.6<br />
Adicione o seguinte arquivo na pasta orientacao-a-objetos. Depois compile e execute a classe TestaTurma.<br />
1 class TestaTurma<br />
2 {<br />
3 static void Main ()<br />
4 {<br />
5 Turma t1 = new Turma ();<br />
6 t1. periodo = " Tarde ";<br />
7 t1. serie = 8;<br />
8 t1. sigla = "A";<br />
9 t1. tipoDeEnsino = " Fundamental ";<br />
10<br />
11 Turma t2 = new Turma ();<br />
12 t2. periodo = " Manha ";<br />
13 t2. serie = 5;<br />
14 t2. sigla = "B";<br />
15 t2. tipoDeEnsino = " Fundamental ";<br />
16<br />
17 System . Console . WriteLine (t1. periodo );<br />
18 System . Console . WriteLine (t1. serie );<br />
19 System . Console . WriteLine (t1. sigla );<br />
20 System . Console . WriteLine (t1. tipoDeEnsino );<br />
21<br />
22 System . Console . WriteLine (t2. periodo );<br />
23 System . Console . WriteLine (t2. serie );<br />
24 System . Console . WriteLine (t2. sigla );<br />
25 System . Console . WriteLine (t2. tipoDeEnsino );<br />
26 }<br />
27 }<br />
Código <strong>C#</strong> 3.25: TestaTurma.cs<br />
166 www.k19.com.br