Created
July 22, 2019 01:06
-
-
Save NyKaren/a42c24ef9543a497f1ffb5812f2c2b75 to your computer and use it in GitHub Desktop.
Intelij
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/solutis12.iml" filepath="$PROJECT_DIR$/solutis12.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eclipse.preferences.version=1 | |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | |
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | |
org.eclipse.jdt.core.compiler.compliance=1.8 | |
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | |
org.eclipse.jdt.core.compiler.debug.localVariable=generate | |
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | |
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | |
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | |
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<classpath> | |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | |
<classpathentry kind="src" path="src"/> | |
<classpathentry kind="output" path="bin"/> | |
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<projectDescription> | |
<name>solutis12</name> | |
<comment></comment> | |
<projects> | |
</projects> | |
<buildSpec> | |
<buildCommand> | |
<name>org.eclipse.jdt.core.javabuilder</name> | |
<arguments> | |
</arguments> | |
</buildCommand> | |
</buildSpec> | |
<natures> | |
<nature>org.eclipse.jdt.core.javanature</nature> | |
</natures> | |
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |
<exclude-output /> | |
<content url="file://$MODULE_DIR$"> | |
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package defora; | |
import solutis12.Cat; | |
public class Batatinha extends Cat { | |
private String nome; | |
public String getNome() { | |
return this.nome; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package defora; | |
import solutis12.Cat; | |
public class Garfield extends Cat { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package defora; | |
import interfaceManda.GatoViraLatas; | |
import interfaceManda.Labrador; | |
import solutis12.MandaChuva; | |
public class mainFora { | |
public static void main(String[] args) { | |
GatoViraLatas mingau = new MandaChuva(); | |
mingau.quantidadeLatasViradas(40); | |
System.out.println("Latas: " + String.valueOf(mingau.getQtdLatasViradas())); | |
mingau.setQtdLatasViradas(40); | |
System.out.println(String.valueOf(mingau.getQtdLatasViradas())); | |
GatoViraLatas pepita = new Labrador(); | |
pepita.quantidadeLatasViradas(30); | |
System.out.println(String.valueOf(pepita.getQtdLatasViradas())); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exercicio; | |
public class AcoesDeZeroATrinta { | |
// imprime na tela a soma dos n�meros �mpares entre 0 e 30 | |
public void somaImpares() { | |
int soma = 0; | |
for(int i = 1; i<31; i++) { | |
if(i%2 !=0) { | |
soma+= i; | |
} | |
} | |
System.out.println("A soma dos n�meros �mpares entre 0 e 30 gera: " + String.valueOf(soma)); | |
} | |
//imprime na tela a multiplica��o dos n�meros pares entre 0 e 30 | |
public void multiplicaPares() { | |
int multiplicacao = 0; | |
for(int i = 1; i<31; i++) { | |
if(i%2 ==0) { | |
multiplicacao*= i; | |
} | |
} | |
System.out.println("A multiplica��o dos n�meros pares entre 0 e 30 gera: " + String.valueOf(multiplicacao)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exercicio; | |
public class ComparaNumero { | |
//Mostre o maior e o menor (nesta sequ�ncia) de n�meros e se s�o iguais | |
public void comparaNumero(Integer numero1, Integer numero2) { | |
if(numero1 > numero2) { | |
System.out.println("Os n�meros s�o diferentes: " + String.valueOf(numero1)+ " e " + String.valueOf(numero2)); | |
} else if (numero2 > numero1) { | |
System.out.println("Os n�meros s�o diferentes: " + String.valueOf(numero2)+ " e " + String.valueOf(numero1)); | |
} else { | |
System.out.println("Os n�meros "+ String.valueOf(numero1) +" s�o iguais."); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exercicio; | |
public class mainNum { | |
public static void main(String[] args) { | |
MaiorNumero num = new MaiorNumero(); | |
NumeroDecrescente num2 = new NumeroDecrescente(); | |
num.maiorNumero(5,4); | |
num2.numeroDecrescente(4); | |
AcoesDeZeroATrinta acoes = new AcoesDeZeroATrinta(); | |
acoes.somaImpares(); | |
acoes.multiplicaPares(); | |
TrocaNumero trocaNumero = new TrocaNumero(); | |
trocaNumero.trocaNumero(4, 5); | |
ComparaNumero comparaNumero = new ComparaNumero(); | |
comparaNumero.comparaNumero(5, 3); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exercicio; | |
public class MaiorNumero { | |
//Esse m�todo imprime o maior n�mero entre os dois do par�metro | |
public void maiorNumero(Integer numero1, Integer numero2) { | |
Integer maior = numero2; | |
if(numero1 > numero2) maior = numero1; | |
System.out.println("O maior n�mero �: " + String.valueOf(maior)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exercicio; | |
public class MediaAluno { | |
/* | |
* Crie uma classe MediaAluno que contenha um atributo do tipo vetor de inteiros com o nome de notas. Essa classe deve ter um m�todo para adicionar as notas nesse vetor (os valores que podem ser adicionados no vetor s�o os inteiros entre 0 e 100, caso contr�rio imprime uma mensagem de erro e n�o adiciona) e outro m�todo que calcule a m�dia de um aluno e imprima essa m�dia. | |
*/ | |
private Aluno[] alunos = new Aluno[100]; | |
public void adiciona(Aluno aluno) { | |
// implementa��o | |
} | |
public void adiciona(int posicao, Aluno aluno) { | |
// implementa��o | |
} | |
public Aluno pega(int posicao) { | |
// implementa��o | |
} | |
public void remove(int posicao) { | |
// implementa��o | |
} | |
public boolean contem(Aluno aluno) { | |
// implementa��o | |
} | |
public int tamanho() { | |
// implementa��o | |
} | |
public String toString() { | |
return Arrays.toString(alunos); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exercicio; | |
public class NumeroDecrescente { | |
//Esse m�todo imprime do n�mero do par�metro at� 0, decrescentemente | |
public void numeroDecrescente(Integer numero) { | |
int i = numero; | |
do { | |
System.out.println(i); | |
i-=1; | |
} while(i>=0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exercicio; | |
public class TrocaNumero { | |
// Imprime os n�meros de entrada em ordem inversa | |
public void trocaNumero (Integer NumA, Integer NumB) { | |
Integer c = NumA; | |
NumA = NumB; | |
NumB = c; | |
System.out.println(String.valueOf(NumA) + " e " + String.valueOf(NumB) ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interfaceManda; | |
import solutis12.Cat; | |
import solutis12.MandaChuva; | |
public class EakTheCat { | |
public static String getNome1(Cat gato) { | |
return gato.getNome(); | |
} | |
public static String getNome2(Cat gato) { | |
// No eclipse n�o funciona, mas no Intelij funciona. | |
/* | |
* if(gato instanceof MandaChuva) { MandaChuva chuva = (MandaChuva) gato; | |
* chuva.manda(); } | |
*/ | |
return gato.getNome(); | |
} | |
//todas extendem de object | |
public static String getNome(Object gato) { | |
// No eclipse n�o funciona, mas no Intelij funciona. | |
if(gato instanceof MandaChuva) { | |
MandaChuva chuva = (MandaChuva) gato; | |
chuva.manda(); | |
//chuva.getNome(); imprime nada no Intelij | |
} | |
return ""; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interfaceManda; | |
public class Labrador implements GatoViraLatas { | |
private Integer qtdLatasViradas; | |
@Override | |
public void quantidadeLatasViradas(Integer latas) { | |
this.qtdLatasViradas = 2 * latas; | |
} | |
@Override | |
public Integer getQtdLatasViradas() { | |
return this.qtdLatasViradas; | |
} | |
@Override | |
public void setQtdLatasViradas(Integer q) { | |
this.qtdLatasViradas = q; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interfaceManda; | |
public class Lata { | |
String cor; | |
public void revirar() { | |
System.out.println("Virou a lata!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package solutis12; | |
public class Cat { | |
private String nome; | |
private String corDoPelo; | |
private int peso; | |
public static Boolean TEM_RABO = true; | |
//public final Boolean TEM_RABO = true; --� imut�vel | |
public String falar(String fala) { | |
return fala; | |
} | |
public String falar(String fala, Integer quantidade) { | |
return fala + String.valueOf(quantidade) + " vezes mais r�pido."; | |
} | |
protected void comer() { | |
} | |
private void doContra() { | |
} | |
public String getCorDoPelo() { | |
return this.corDoPelo; | |
} | |
public void setCorDoPelo(String c) { | |
this.corDoPelo = c; | |
} | |
public int getPeso() { | |
return this.peso; | |
} | |
public void setPeso(int p) { | |
this.peso = p; | |
} | |
public String getNome() { | |
return this.nome; | |
} | |
public void setNome(String a) { | |
this.nome = a; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package solutis12; | |
import interfaceManda.GatoViraLatas; | |
public class MandaChuva implements GatoViraLatas{ | |
private Integer qtdLatasViradas; | |
@Override | |
public void quantidadeLatasViradas(Integer latas) { | |
this.qtdLatasViradas = latas; | |
} | |
@Override | |
public Integer getQtdLatasViradas() { | |
return this.qtdLatasViradas; | |
} | |
@Override | |
public void setQtdLatasViradas(Integer q) { | |
this.qtdLatasViradas = q; | |
} | |
public void manda() { | |
System.out.println("Entrei"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package solutis12; | |
import interfaceManda.GatoViraLatas2; | |
public class Munchkin extends GatoViraLatas2 { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package solutis12; | |
import defora.Batatinha; | |
import defora.Garfield; | |
import interfaceManda.GatoViraLatas2; | |
public class Rodar { | |
public static void main(String[] args) { | |
Cat gato = new Cat(); | |
System.out.println("fjdsfhjdsh"); | |
gato.setNome("Mingau"); | |
gato.setPeso(5); | |
System.out.println(gato.getNome() + " tem " + gato.getPeso() + " quilos."); | |
System.out.println(gato.falar("Miaaaaaaaaaaaaaau")); | |
System.out.println(gato.falar("Morra humano ", 5)); | |
//Munchkin anao = new GatoViraLatas2(); � tipo Munchkin | |
//anao. n�o aparece revirarLata | |
Garfield gatinho = new Garfield(); | |
gatinho.falar("ebaaaaaaaaaa"); //herda o m�todo | |
gatinho.comer();//herda o m�todo protected | |
//gatinho.doContra(); n�o herda o m�todo private | |
Batatinha batatinha = new Batatinha(); | |
batatinha.setNome("Vivante"); //batatinha n�o tem set override | |
gatinho.setNome("Vivante2"); | |
System.out.println(batatinha.getNome()); //pega o valor do atributo de batatinha que est� vazio | |
System.out.println(gatinho.getNome()); | |
//Cat.temRabo; Eclipse n�o permite, mas o Intelij sim. FUNCIONA! | |
gatinho.TEM_RABO = false; | |
System.out.println(String.valueOf(gatinho.TEM_RABO)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment