26.08.2014 Views

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.

173 RESPOSTAS<br />

Resposta do Exercise 6.4<br />

Altere a classe TestaValeRefeicao.<br />

1 class TestaValeRefeicao<br />

2 {<br />

3 static void Main ( string [] args )<br />

4 {<br />

5 System . Console . WriteLine ( Funcionario . valeRefeicaoDiario );<br />

6 Funcionario . valeRefeicaoDiario = 15;<br />

7 System . Console . WriteLine ( Funcionario . valeRefeicaoDiario );<br />

8<br />

9 Funcionario . ReajustaValeRefeicaoDiario (0.1) ;<br />

10 System . Console . WriteLine ( Funcionario . valeRefeicaoDiario );<br />

11 }<br />

12 }<br />

Código <strong>C#</strong> 6.17: Funcionario.cs<br />

Resposta do Exercise 7.1<br />

1 class Conta<br />

2 {<br />

3 public double Saldo { get ; set ; }<br />

4 public double Limite { get ; set ; }<br />

5 }<br />

Código <strong>C#</strong> 7.18: Conta.cs<br />

Resposta do Exercise 7.2<br />

1 class TestaConta<br />

2 {<br />

3 static void Main ()<br />

4 {<br />

5 Conta c = new Conta ();<br />

6<br />

7 c. Limite = 1000;<br />

8 c. Saldo = 2000;<br />

9<br />

10 System . Console . WriteLine (c. Limite );<br />

11 System . Console . WriteLine (c. Saldo );<br />

12 }<br />

13 }<br />

Código <strong>C#</strong> 7.19: TestaConta.cs<br />

Selecione a classe TestaConta como Startup Object. Depois compile (F6) e execute (CTRL + F5).<br />

Resposta do Exercise 8.1<br />

www.facebook.com/k19treinamentos 173

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!