Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- public class Cad_Vendas1 {
- private static String [] cadastro;
- private static String Codigo_produto;
- private static String Nome_Produto;
- private static String Preco_vendas;
- private static String Preco_custo;
- private static String menu = "========= SISTEMA DE VENDAS =========\n\n" +
- "[1]:....................CADASTRAR PRODUTOS\n"
- +"[2]:....................VENDAS\n"
- +"[3]:....................COSULTA\n"
- +"[4]:....................RELATORIO\n"
- +"[5]:....................SAIR\n";
- public static void main (String [] args){
- String opcao = "";
- do {
- opcao = JOptionPane.showInputDialog(menu);
- if(opcao.equals("1"))
- { Cadastrar_Produtos();
- }if(opcao.equals("2")){
- Realizar_Vendas();
- }if(opcao.equals("3")){
- Consultar();
- }if(opcao.equals("4")){
- Relatorio();
- }
- }
- while(!opcao.equals("5"));
- }
- private static void Cadastrar_Produtos() {
- // TODO Auto-generated method stub
- int qtd = Integer.parseInt(JOptionPane.showInputDialog("Digite a quntidade de produto que deseja cdastrar"));
- cadastro = new String [qtd];
- for(int i = 0; i < qtd; i ++){
- Nome_Produto = JOptionPane.showInputDialog("Digite nome do produto: ");
- Codigo_produto = JOptionPane.showInputDialog("Digite Codigo: ");
- Preco_custo = (JOptionPane.showInputDialog("Preco de custo"));
- Preco_vendas = (JOptionPane.showInputDialog("Preco de Venda"));
- }
- JOptionPane.showMessageDialog(null, "Produtos cadastrados com sucesso!");
- }
- private static void Realizar_Vendas() {
- // TODO Auto-generated method stub
- }
- private static void Consultar() {
- // TODO Auto-generated method stub
- String opcao = "";
- String procura = null;
- String Menu_Consulta = "\n\n[A]:.............. Consultar por Código \n"
- +"[B]:..............Consultar po nome \n"
- +"[C]:..............SAir do modo Pesquisa";
- opcao = JOptionPane.showInputDialog(Menu_Consulta);
- if(opcao.equalsIgnoreCase("A"))
- {
- int Codigo_De_Procura = Integer.parseInt(JOptionPane.showInputDialog("Digite O codigo do produto"));
- for(int i = 0; i < cadastro.length; i ++){
- if(cadastro[i].equals(Codigo_De_Procura)){
- procura = cadastro[i];
- }JOptionPane.showMessageDialog(null, "Relatorio de pesquisa \n\n" + procura);
- }
- }
- }
- private static String toString(String string) {
- // TODO Auto-generated method stub
- return null;
- }
- private static void Relatorio() {
- // TODO Auto-generated method stub
- String relatorio = "################## RELATORIO ################# \n\n";
- for (int i = 0; i < cadastro.length; i ++){
- relatorio += "NOME do produto: " + Nome_Produto + "\n";
- relatorio += "Codigo: " + Codigo_produto + "\n";
- relatorio += "preço de venda: " +Preco_vendas + "\n";
- relatorio += "preço de Custo: " +Preco_custo + "\n";
- relatorio += " ---------------------------------------------------------------\n";
- }
- JOptionPane.showMessageDialog(null," "+ relatorio);
- }
- }
Add Comment
Please, Sign In to add comment