Skip to content

Instantly share code, notes, and snippets.

View dariogabriel113's full-sized avatar
:shipit:
...

Dario Gabriel dariogabriel113

:shipit:
...
  • FCPC - Fundação Cearense de Pesquisa e Cultura
  • Fortaleza - Brazil
View GitHub Profile
@dariogabriel113
dariogabriel113 / AddDate.groovy
Last active March 22, 2019 12:54
Add/Subtract Date Time
use (groovy.time.TimeCategory) {
//Example of Add Date 20 days from now
println new Date()
println 20.days.from.now
//Example of Add Date 3 months from now
println new Date()
println 3.months.from.now
//Example of Add Date 2 years from now
@dariogabriel113
dariogabriel113 / IA-ClassEstado
Created September 7, 2018 17:05
Estado atual de trabalho de IA
class Estado {
List<String> posicoes
int nome
Estado pai
static constraints = {
pai nullable: true
}
}
public class TesteIR2 {
public static void main(String[] args) {
// De 1900.0 até 2800.0 o IR é de 7.5% e pode deduzir R$ 142
// De 2800.01 até 3751.0 o IR é de 15% e pode deduzir R$ 350
// De 3751.01 até 4664.00 o IR é de 22.5% e pode deduzir R$ 636
double salario = 3800.0;
if (salario >= 1900.0 && salario <= 2800.0) {
System.out.println("A sua aliquota é de 7%");
public class TestWhile {
public static void main(String[] args) {
int count = 0;
while (count <= 10) {
System.out.println(count);
count++;
}
}
}
public class TestaLaco2 {
public static void main(String[] args) {
for (int linha = 0; linha < 10; linha++) {
for (int coluna = 0; coluna <= linha; coluna++) {
System.out.print("*");
}
System.out.println();
}
}
}
public class TestaLacos {
public static void main(String[] args) {
for (int multiplicador = 1; multiplicador <= 10; multiplicador++) {
for (int contador = 0; contador <= 10; contador++) {
System.out.print(multiplicador * contador);
System.out.print(" ");
}
System.out.println();
}
}
public class TestFor {
public static void main(String[] args) {
for (int count = 0; count <= 10; count++) {
System.out.println(count);
}
}
}
public class TestaEscopo {
public static void main(String[] args) {
System.out.println("testando condicionais");
int idade = 20;
int quantidadePessoas = 3;
boolean acompanhado = false;
if (quantidadePessoas >= 2) {
acompanhado = true;
class MultiplosDeTresAteCem {
public static void main(String[] args) {
for (int i = 3; i < 100; i += 3) {
System.out.println(i);
}
}
}
public class Fatorial {
public static void main(String[] args) {
int fatorial = 1;
for (int i = 1; i < 11; i++) {
fatorial *= i;
System.out.println("Fatorial de " + i + " = " + fatorial);
}
}
}