Untitled
unknown
plain_text
9 months ago
3.5 kB
3
Indexable
package pregunta_02; public class Moviles { private int codigoProducto; private int unidadesVendidas; private double precioProducto; private double descuentoVenta; private static int a_unidadesVendidas = 0; private static double a_importeSubtotal = 0; private static double a_importeIgv = 0; private static double a_importePagar = 0; public Moviles () { } public Moviles(int unidadesVendidas) { super(); this.unidadesVendidas = unidadesVendidas; } public Moviles(int codigoProducto, int unidadesVendidas, double precioProducto, double descuentoVenta) { super(); this.codigoProducto = codigoProducto; this.unidadesVendidas = unidadesVendidas; this.precioProducto = precioProducto; this.descuentoVenta = retornaImporteDescuento() ; a_unidadesVendidas += this.unidadesVendidas; a_importeSubtotal += this.unidadesVendidas * this.precioProducto; a_importeIgv += retornaImporteIgv(); a_importePagar += retornaImporteTotalPagar(); } public int getCodigoProducto() { return codigoProducto; } public void setCodigoProducto(int codigoProducto) { this.codigoProducto = codigoProducto; } public int getUnidadesVendidas() { return unidadesVendidas; } public void setUnidadesVendidas(int unidadesVendidas) { this.unidadesVendidas = unidadesVendidas; } public double getPrecioProducto() { return precioProducto; } public void setPrecioProducto(double precioProducto) { this.precioProducto = precioProducto; } public double getDescuentoVenta() { return descuentoVenta; } public void setDescuentoVenta(double descuentoVenta) { this.descuentoVenta = descuentoVenta; } public static int getA_unidadesVendidas() { return a_unidadesVendidas; } public static void setA_unidadesVendidas(int a_unidadesVendidas) { Moviles.a_unidadesVendidas = a_unidadesVendidas; } public static double getA_importeSubtotal() { return a_importeSubtotal; } public static void setA_importeSubtotal(double a_importeSubtotal) { Moviles.a_importeSubtotal = a_importeSubtotal; } public static double getA_importeIgv() { return a_importeIgv; } public static void setA_importeIgv(double a_importeIgv) { Moviles.a_importeIgv = a_importeIgv; } public static double getA_importePagar() { return a_importePagar; } public static void setA_importePagar(double a_importePagar) { Moviles.a_importePagar = a_importePagar; } public double retornaImporteSubtotal () { return this.unidadesVendidas * this.precioProducto; } public double retornaDescuento (double descuento) { if (retornaImporteSubtotal() > 1500 && retornaImporteSubtotal() <= 3000) { descuento = 0.05; } else if (retornaImporteSubtotal() > 3000 && retornaImporteSubtotal() <= 4500) { descuento = 0.07; } else if (retornaImporteSubtotal() <= 1500) { descuento = 0.0; } else { descuento = 0.1; } return descuento; } public double retornaImporteDescuento () { return retornaImporteSubtotal() * retornaDescuento(descuentoVenta); } public double retornaImporteConDescuento () { return retornaImporteSubtotal() - retornaImporteDescuento(); } public double retornaImporteIgv () { return retornaImporteConDescuento() * 0.18; } public double retornaImporteTotalPagar () { return retornaImporteConDescuento () + retornaImporteIgv(); } }
Editor is loading...
Leave a Comment