-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Código-fonte dos projetos do Mergulho Java
- Loading branch information
0 parents
commit 150dc33
Showing
164 changed files
with
5,561 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
.metadata/ | ||
.idea/ | ||
*.iml |
29 changes: 29 additions & 0 deletions
29
Aula 1.2 - Fundamentos da linguagem Java/mergulho-java/.gitignore
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### IntelliJ IDEA ### | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
22 changes: 22 additions & 0 deletions
22
Aula 1.2 - Fundamentos da linguagem Java/mergulho-java/src/CalculadoraCortisol.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
public class CalculadoraCortisol { | ||
|
||
public static void main(String[] args) { | ||
double cortisol = 3; | ||
|
||
// boolean resultadoNormal = cortisol >= 6.0 && cortisol <= 18.4; | ||
// boolean resultadoAnormal = cortisol < 6.0 || cortisol > 18.4; | ||
// boolean resultadoAnormal = !resultadoNormal; | ||
|
||
// System.out.println("Cortisol normal: " + resultadoNormal); | ||
// System.out.println("Cortisol anormal: " + resultadoAnormal); | ||
|
||
if (cortisol >= 6.0 && cortisol <= 18.4) { | ||
System.out.println("Cortisol normal"); | ||
} else if (cortisol > 18.4) { | ||
System.out.println("Cortisol alto"); | ||
} else { | ||
System.out.println("Cortisol baixo"); | ||
} | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
... 1.2 - Fundamentos da linguagem Java/mergulho-java/src/CalculadoraJurosCompostosMeta.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
public class CalculadoraJurosCompostosMeta { | ||
|
||
public static void main(String[] args) { | ||
double valorAcumulado = 10_000; | ||
double valorMeta = 20_000; | ||
double taxaJurosMensal = 0.8; | ||
int mes = 0; | ||
|
||
while (valorAcumulado < valorMeta) { | ||
mes++; | ||
|
||
valorAcumulado += valorAcumulado * taxaJurosMensal / 100; | ||
System.out.println("Mês " + mes + " = " + valorAcumulado); | ||
} | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...1.2 - Fundamentos da linguagem Java/mergulho-java/src/CalculadoraJurosCompostosTempo.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
public class CalculadoraJurosCompostosTempo { | ||
|
||
public static void main(String[] args) { | ||
double valorAcumulado = 10_000; | ||
double taxaJurosMensal = 0.8; | ||
int periodoEmMeses = 12; | ||
|
||
for (int mes = 1; mes <= periodoEmMeses; mes++) { | ||
valorAcumulado += valorAcumulado * taxaJurosMensal / 100; | ||
System.out.println("Mês " + mes + " = " + valorAcumulado); | ||
} | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
Aula 1.2 - Fundamentos da linguagem Java/mergulho-java/src/OlaMergulhador.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
public class OlaMergulhador { | ||
|
||
public static void main(String[] args) { | ||
System.out.println("Olá, mergulhador!"); | ||
|
||
String nomeCompleto = "José Sebastião"; | ||
nomeCompleto = "João da Silva"; | ||
|
||
System.out.println("Nome: " + nomeCompleto); | ||
|
||
int minhaIdade = 41; | ||
int suaIdade = 25; | ||
int totalIdades = minhaIdade + suaIdade; | ||
System.out.println(totalIdades); | ||
|
||
double peso = 84.9d; | ||
System.out.println(peso); | ||
|
||
float taxa = 1_294.93f; | ||
|
||
boolean compraAprovada = false; | ||
System.out.println(compraAprovada); | ||
|
||
boolean maiorDeIdade = minhaIdade != 42; | ||
System.out.println(maiorDeIdade); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
Aula 1.3 - Orientação a objetos, classes e objetos/banco/.gitignore
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### IntelliJ IDEA ### | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
8 changes: 8 additions & 0 deletions
8
Aula 1.3 - Orientação a objetos, classes e objetos/banco/src/Conta.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
public class Conta { | ||
|
||
Pessoa titular; | ||
int agencia; | ||
int numero; | ||
double saldo; | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
Aula 1.3 - Orientação a objetos, classes e objetos/banco/src/Pessoa.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class Pessoa { | ||
|
||
String nome; | ||
String documento; | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
Aula 1.3 - Orientação a objetos, classes e objetos/banco/src/Principal.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
public class Principal { | ||
|
||
public static void main(String[] args) { | ||
Pessoa titular1 = new Pessoa(); | ||
titular1.nome = "João da Silva"; | ||
titular1.documento = "12312312311"; | ||
|
||
Pessoa titular2 = new Pessoa(); | ||
titular2.nome = "Maria Abadia"; | ||
titular2.documento = "22233344455"; | ||
|
||
Conta minhaConta = new Conta(); | ||
minhaConta.titular = titular1; | ||
minhaConta.agencia = 123; | ||
minhaConta.numero = 987; | ||
minhaConta.saldo = 15_000; | ||
|
||
Conta suaConta = new Conta(); | ||
suaConta.titular = titular2; | ||
suaConta.agencia = 222; | ||
suaConta.numero = 333; | ||
suaConta.saldo = 30_000; | ||
|
||
System.out.println("Titular: " + minhaConta.titular.nome); | ||
System.out.println("Saldo: " + minhaConta.saldo); | ||
|
||
System.out.println("Titular: " + suaConta.titular.nome); | ||
System.out.println("Saldo: " + suaConta.saldo); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
Aula 1.4 - Métodos, construtores e sobrecarga/banco/.gitignore
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### IntelliJ IDEA ### | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
43 changes: 43 additions & 0 deletions
43
Aula 1.4 - Métodos, construtores e sobrecarga/banco/src/Conta.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import java.util.Objects; | ||
|
||
public class Conta { | ||
|
||
Pessoa titular; | ||
int agencia; | ||
int numero; | ||
double saldo; | ||
|
||
Conta() { | ||
} | ||
|
||
Conta(Pessoa titular, int agencia, int numero) { | ||
Objects.requireNonNull(titular); | ||
|
||
this.titular = titular; | ||
this.agencia = agencia; | ||
this.numero = numero; | ||
} | ||
|
||
void depositar(double valor) { | ||
if (valor <= 0) { | ||
throw new IllegalArgumentException("Valor deve ser maior que 0"); | ||
} | ||
saldo = saldo + valor; | ||
} | ||
|
||
void sacar(double valor) { | ||
if (valor <= 0) { | ||
throw new IllegalArgumentException("Valor deve ser maior que 0"); | ||
} | ||
|
||
if (saldo - valor < 0) { | ||
throw new IllegalStateException("Saldo insuficiente"); | ||
} | ||
saldo = saldo - valor; | ||
} | ||
|
||
void sacar(double valor, double taxaSaque) { | ||
sacar(valor + taxaSaque); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
Aula 1.4 - Métodos, construtores e sobrecarga/banco/src/Pessoa.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class Pessoa { | ||
|
||
String nome; | ||
String documento; | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
Aula 1.4 - Métodos, construtores e sobrecarga/banco/src/Principal.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
public class Principal { | ||
|
||
public static void main(String[] args) { | ||
Pessoa titular1 = new Pessoa(); | ||
titular1.nome = "João da Silva"; | ||
titular1.documento = "12312312311"; | ||
|
||
Pessoa titular2 = new Pessoa(); | ||
titular2.nome = "Maria Abadia"; | ||
titular2.documento = "22233344455"; | ||
|
||
Conta minhaConta = new Conta(titular1, 123, 987); | ||
// minhaConta.titular = titular1; | ||
// minhaConta.agencia = 123; | ||
// minhaConta.numero = 987; | ||
// minhaConta.saldo = 15_000; | ||
|
||
Conta suaConta = new Conta(); | ||
suaConta.titular = titular2; | ||
suaConta.agencia = 222; | ||
suaConta.numero = 333; | ||
// suaConta.saldo = 30_000; | ||
|
||
minhaConta.depositar(15_000); | ||
suaConta.depositar(30_000); | ||
|
||
minhaConta.sacar(1_000, 10); | ||
|
||
System.out.println("Titular: " + minhaConta.titular.nome); | ||
System.out.println("Saldo: " + minhaConta.saldo); | ||
|
||
System.out.println("Titular: " + suaConta.titular.nome); | ||
System.out.println("Saldo: " + suaConta.saldo); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### IntelliJ IDEA ### | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Oops, something went wrong.