Skip to content

Commit

Permalink
add banco de dados
Browse files Browse the repository at this point in the history
  • Loading branch information
erikabusiness committed Nov 7, 2023
1 parent 696eade commit 039022a
Show file tree
Hide file tree
Showing 36 changed files with 1,798 additions and 0 deletions.
11 changes: 11 additions & 0 deletions banco_de_dados/Java/the_discoverer_experience/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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-18">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="C:/Users/55799/Downloads/mysql-connector-j-8.1.0/mysql-connector-j-8.1.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions banco_de_dados/Java/the_discoverer_experience/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>the_discoverer_experience</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>
<filteredResources>
<filter>
<id>1697330209562</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=18
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=18
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.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=18
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
102 changes: 102 additions & 0 deletions banco_de_dados/Java/the_discoverer_experience/src/aplicacao/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package aplicacao;

import java.util.Scanner;

import dao.UsuarioDAO;
import model.Usuario;

public class Main {

public static void main(String[] args) {

Scanner s = new Scanner(System.in);
UsuarioDAO usuarioDAO = new UsuarioDAO();

int opcao = 0, id = 0;

String nome, email, senha, cpf, localizacao;


do {

System.out.println("\n============================== USUARIOS =================================\n");
System.out.println("1-CRIAR 2-CONSULTAR 3-ATUALIZAR 4-DELETAR 5-CONSULTAR POR ID 0-SAIR");
opcao = s.nextInt();
s.nextLine();

switch (opcao) {
case 1:
System.out.println("Digite a senha:");
senha = s.nextLine();
System.out.println("Digite o email:");
email = s.nextLine();
System.out.println("Digite o CPF:");
cpf = s.nextLine();
System.out.println("Digite o nome:");
nome = s.nextLine();
System.out.println("Digite a localização:");
localizacao = s.nextLine();

Usuario usuario1 = new Usuario(senha, email, cpf, nome, localizacao);

usuarioDAO.create(usuario1);
break;
case 2:

for (Usuario u : usuarioDAO.read()) {
System.out.println(u.toString());
}

break;
case 3:

System.out.println("Digite o id:");
id = s.nextInt();
s.nextLine();
System.out.println("Digite a senha:");
senha = s.nextLine();
System.out.println("Digite o email:");
email = s.nextLine();
System.out.println("Digite o CPF:");
cpf = s.nextLine();
System.out.println("Digite o nome:");
nome = s.nextLine();
System.out.println("Digite a localização:");
localizacao = s.nextLine();


Usuario usuario2 = new Usuario(id, senha, email, cpf, nome, localizacao);

usuarioDAO.update(usuario2);
break;
case 4:
System.out.println("Digite um id:");
id = s.nextInt();
s.nextLine();

usuarioDAO.delete(id);
break;
case 5:
System.out.println("Digite um id:");
id = s.nextInt();
s.nextLine();

Usuario usuario3 = usuarioDAO.readById(id);

System.out.println(usuario3.toString());
break;
default:

break;
}

} while (opcao != 0);

System.out.println("Até mais!");
s.close();

}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package aplicacao;

import java.util.Scanner;

import dao.DestinosDAO;
import model.Destinos;

public class MainDestino {
public static void main(String[] args) {

Scanner s = new Scanner(System.in);
DestinosDAO destinoDAO = new DestinosDAO();

int opcao = 0, id = 0;


do {

System.out.println("\n============================== DESTINOS =================================\n");
System.out.println("1-CRIAR 2-CONSULTAR 3-ATUALIZAR 4-DELETAR 5-CONSULTAR POR ID 0-SAIR");
opcao = s.nextInt();
s.nextLine();

switch (opcao) {
case 1:
System.out.println("Digite o seu destino:");
String nomeDestino = s.nextLine();
System.out.println("Digite a sua avaliação:");
int avaliacao = s.nextInt();
s.nextLine();

Destinos destino1 = new Destinos(nomeDestino, avaliacao);

destinoDAO.create(destino1);
break;
case 2:

for (Destinos d : destinoDAO.read()) {
System.out.println(d.toString());
}

break;
case 3:

System.out.println("Digite o id:");
id = s.nextInt();
s.nextLine();
System.out.println("Digite o seu destino:");
nomeDestino = s.nextLine();
System.out.println("Digite a sua avaliação:");
avaliacao = s.nextInt();
s.nextLine();

Destinos destino2 = new Destinos(id, nomeDestino, avaliacao);

destinoDAO.update(destino2);
break;
case 4:
System.out.println("Digite um id:");
id = s.nextInt();
s.nextLine();

destinoDAO.delete(id);
break;
case 5:
System.out.println("Digite um id:");
id = s.nextInt();
s.nextLine();

Destinos destino3 = destinoDAO.readById(id);

System.out.println(destino3.toString());
break;
default:

break;
}

} while (opcao != 0);

System.out.println("Até mais!");
s.close();

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package aplicacao;

import java.util.Scanner;

import dao.PacotesDAO;
import model.Pacotes;

public class MainPacote {
public static void main(String[] args) {

Scanner s = new Scanner(System.in);
PacotesDAO pacoteDAO = new PacotesDAO();

int opcao = 0, id = 0;


do {

System.out.println("\n============================== PACOTES =================================\n");
System.out.println("1-CRIAR 2-CONSULTAR 3-ATUALIZAR 4-DELETAR 5-CONSULTAR POR ID 0-SAIR");
opcao = s.nextInt();
s.nextLine();

switch (opcao) {
case 1:
System.out.println("Digite o desconto do pacote:");
double descPacote = s.nextDouble();
s.nextLine();
System.out.println("Digite o valor do pacote:");
double valorPacote = s.nextDouble();
s.nextLine();

Pacotes pacote1 = new Pacotes(descPacote, valorPacote);

pacoteDAO.create(pacote1);
break;
case 2:

for (Pacotes p : pacoteDAO.read()) {
System.out.println(p.toString());
}

break;
case 3:

System.out.println("Digite o id:");
id = s.nextInt();
s.nextLine();
System.out.println("Digite o desconto do pacote:");
descPacote = s.nextDouble();
s.nextLine();
System.out.println("Digite o valor do pacote:");
valorPacote = s.nextDouble();
s.nextLine();

Pacotes pacote2 = new Pacotes(id, descPacote, valorPacote);

pacoteDAO.update(pacote2);
break;
case 4:
System.out.println("Digite um id:");
id = s.nextInt();
s.nextLine();

pacoteDAO.delete(id);
break;
case 5:
System.out.println("Digite um id:");
id = s.nextInt();
s.nextLine();

Pacotes pacote3 = pacoteDAO.readById(id);

System.out.println(pacote3.toString());
break;
default:

break;
}

} while (opcao != 0);

System.out.println("Até mais!");
s.close();

}

}
Loading

0 comments on commit 039022a

Please sign in to comment.