/* package whatever; // don't place package name! */
import java.util.* ;
import java.lang.* ;
import java.io.* ;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String [ ] [ ] mat
= matrizPrincipal
( ) ; System .
out .
println ( "1.Listar atores e suas respectivas temporadas." ) ; Scanner in
= new Scanner
( System .
in ) ; switch ( opcao) {
case 1 :
System .
out .
println ( "Digite a temporada à se verificar" ) ; String temporada
= in.
nextLine ( ) ; String resultado2
= imprimeMatrizQualTemporada
( temporada,mat
) ; System .
out .
println ( "Personagens nesta Temporada:" + resultado2
) ; break ;
}
}
public static String [ ] [ ] matrizPrincipal
( ) { matriz[ 0 ] [ 0 ] = "Robin Arryn" ;
matriz[ 0 ] [ 1 ] = "Lino Facioli" ;
matriz[ 0 ] [ 2 ] = "145" ;
matriz[ 0 ] [ 3 ] = "Vivo" ;
matriz[ 0 ] [ 4 ] = "Arryn" ;
matriz[ 0 ] [ 5 ] = "Masculino" ;
matriz[ 1 ] [ 0 ] = "Yohn Royce" ;
matriz[ 1 ] [ 1 ] = "Rupert Vansittart" ;
matriz[ 1 ] [ 2 ] = "45" ;
matriz[ 1 ] [ 3 ] = "Vivo" ;
matriz[ 1 ] [ 4 ] = "Arryn" ;
matriz[ 1 ] [ 5 ] = "Masculino" ;
return matriz;
}
for ( int i = 0 ; i < mat.length ; i++ ) {
if ( mat[ i] [ 2 ] .contains ( temporada) ) {
System .
out .
println ( mat
[ i
] [ 0 ] + "\n " ) ; }
}
return "Não encontramos um personagem com este nome" ;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCn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