Last active
August 3, 2024 02:07
-
-
Save samuelsonbrito/6a8cce20179be1fd5d4b507169a2c82b to your computer and use it in GitHub Desktop.
Video Aula Youtube - Java com Banco de Dados - Canal Descompila
This file contains hidden or 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 br.com.descompila; | |
import java.io.Console; | |
public class Main { | |
static Console console = System.console(); | |
public static void main(String[] args) { | |
int opcao; | |
do { | |
exibirMenu(); | |
opcao = Integer.parseInt(console.readLine()); | |
switch (opcao) { | |
case 0 -> salvarProduto(); | |
case 1 -> buscarTodosProdutos(); | |
case 2 -> buscarProdutoPorId(); | |
case 3 -> atualizarProduto(); | |
case 4 -> excluirProduto(); | |
case 5 -> System.exit(0); | |
default -> System.out.println("Opção inválida!"); | |
} | |
} while (opcao != 0); | |
} | |
private static void exibirMenu() { | |
System.out.println("\n### Menu de Operações ###"); | |
System.out.println("0. Salvar novo produto"); | |
System.out.println("1. Buscar todos produtos"); | |
System.out.println("2. Buscar produto por ID"); | |
System.out.println("3. Atualizar produto"); | |
System.out.println("4. Excluir produto"); | |
System.out.println("5. Sair do programa"); | |
System.out.print("Escolha uma opção: "); | |
} | |
private static void salvarProduto() { | |
System.out.println("\n### Criar Novo Produto ###"); | |
//TODO- Implementar buscar todos | |
} | |
private static void buscarTodosProdutos() { | |
System.out.println("\n### Buscar Todos ###"); | |
//TODO- Implementar buscar todos | |
} | |
private static void buscarProdutoPorId() { | |
System.out.println("\n### Buscar Produto por ID ###"); | |
//TODO- Implementar busca por id | |
} | |
private static void atualizarProduto() { | |
System.out.println("\n### Atualizar Produto ###"); | |
//TODO- Implementar atualizar | |
} | |
private static void excluirProduto() { | |
System.out.println("\n### Excluir Produto ###"); | |
//TODO- Implementar excluir | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment