12.07.2015 Views

k19-k11-orientacao-a.. - Departamento de Sistemas e Computação

k19-k11-orientacao-a.. - Departamento de Sistemas e Computação

k19-k11-orientacao-a.. - Departamento de Sistemas e Computação

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

197 RESPOSTAS1 import java . util . Scanner ;23 class TestaFuncionario {4 public static void main ( String [] args ) {5 Funcionario f = new Funcionario (200) ;67 Scanner scanner = new Scanner ( System .in);89 System . out . println (" Digite o nome do funcionário : ");10 String nome = scanner . nextLine ();11 f. nome = nome ;1213 int opc = 1;14 while ( opc != 0) {15 System . out . println ("\n\n");16 System . out . println (" Escolha a opção <strong>de</strong>sejada :");17 System . out . println ("0 - Sair ");18 System . out . println ("1 - Aumentar salário ");19 System . out . println ("2 - Corrigir nome do funcionário ");20 System . out . println ("3 - Imprimir dados ");21 System . out . println ("\n\n");2223 String valorTela = scanner . nextLine ();24 opc = Integer . parseInt ( valorTela );2526 if ( opc == 1) {27 System . out . println (" Digite o quanto você <strong>de</strong>seja aumentar : ");28 valorTela = scanner . nextLine ();29 int aumentar = Integer . parseInt ( valorTela );3031 if ( aumentar < 0) {32 System . out . println (" ERRO ");33 } else {34 f. salario += aumentar ;35 System . out . println (" Aumento efetuado com sucesso ");36 }37 } else if ( opc == 2) {38 System . out . println (" Nome atual : " + f. nome );3940 System . out . println (" Digite o novo nome .");41 valorTela = scanner . nextLine ();42 f. nome = valorTela ;4344 System . out . println (" Substituição feita com sucesso .");45 } else if ( opc == 3) {46 System . out . println (" Dados atuais ");47 System . out . println (" Nome : " + f. nome );48 System . out . println (" Salário : " + f. salario );49 }50 }51 }52 }Código Java 3.82: Main2.javaResposta do Complementar 4.11 class Media {2 public static void main ( String [] args ) {3 double soma = 0;4 for ( String arg : args ) {www.<strong>k19</strong>.com.br 197

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

Saved successfully!

Ooh no, something went wrong!