Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Ticket {
- private double importe = 0;
- private int ticketCerrado = 0;
- private int cantidad;
- /*
- * ticketCerrado. 0 equivale a false, 1 equivale a true.
- *
- */
- public void agregarItem(int cantidad, double precioUnitario){
- this.cantidad = cantidad;
- if (cantidad > 0 && precioUnitario > 0 && ticketCerrado == 0){
- importe = (cantidad*precioUnitario);
- }
- }
- public void aplicarDescuento(double porcentaje){
- importe = importe - ((importe*porcentaje)/100);
- }
- public double calcularSubtotal(){
- return(importe);
- }
- public double calcularTotal(){
- ticketCerrado = 1;
- return(cantidad);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment