Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package es.uv.eu.practica1;
- import java.util.HashSet;
- import javax.swing.JOptionPane;
- /**
- *
- * @author marin
- */
- public class Practica1 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- HashSet<Cliente> clientes = new HashSet<Cliente>();
- HashSet<Producto> productos = new HashSet<Producto>();
- String nomc,nomp, dir, cantidad, precio ;
- int continuar, cont, vip, cant, pr;
- boolean V = false;
- do
- {
- nomc=JOptionPane.showInputDialog(null,"Introduce tu nombre ");
- dir=JOptionPane.showInputDialog(null,"Introduce tu direccion ");
- vip= JOptionPane.showConfirmDialog(null,"¿Eres VIP?", "Seleccione la opcion deseada",JOptionPane.YES_NO_OPTION);
- if (vip == 0)
- V = true;
- else if (vip == 1)
- V = false;
- do
- {
- nomp=JOptionPane.showInputDialog(null,"Introduce el nombre del producto ");
- cantidad =JOptionPane.showInputDialog(null,"Introduce la cantidad del producto: ");
- precio =JOptionPane.showInputDialog(null,"Introduce el precio del producto: ");
- cont= JOptionPane.showConfirmDialog(null,"¿Quieres añadir más productos?", "Seleccione la opcion deseada",JOptionPane.YES_NO_OPTION);
- cant= Integer.parseInt(cantidad);
- pr= Integer.parseInt(precio);
- Producto p = new Producto (nomp, cant, pr);
- productos.add(p);
- }while (cont == 0);
- continuar= JOptionPane.showConfirmDialog(null,"Quieres continuar?", "Seleccione la opcion deseada",JOptionPane.YES_NO_OPTION);
- Cliente cliente = new Cliente(nomc,dir,V, productos);
- clientes.add(cliente);
- } while (continuar == 0);
- JOptionPane.showMessageDialog(null,clientes.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement