Sei sulla pagina 1di 7

UNIVERSIDAD MARIANO GLVEZ DE GUATEMALA

EXTENSIN SANTA ELENA, FLORES, PETN


FACULTAD DE INGENIERA EN SISTEMAS DE INFORMACIN
Y CIENCIA DE LA COMPUTACIN

CURSO:
PROGRAMACIN II

CATEDRTICO:
ING. JORGE ALAN CAMEY VSQUEZ

TEMA:
EJERCICIO DEL PRIMER PARCIAL

ESTUDIANTE:
ONIEL ESTUARDO CAJBN BOL

SECCIN:
A

CARN:
1690-14-17248

SANTA ELENA, FLORES, PETN 29 DE AGOSTO DE 2015


TAREA 2

Ejercicio del Parcial (Net Beans)

1. Pedido encabezado

a. Atributos:
-idPedido: tipo entero
-fecha: tipo de dato dd-mm-yy
-nit: tipo de dato string
-observacin: tipo de dato string
-fechasistema: tipo de dato dd-mm-yy
b. Metodos:
Constructor con o sin parmetros
Mtodo que permia validar que la fecha sea mayor o igual a fecha del sistema
Mtodo que permita activar o desactivar un pedido

2. Pedido Detalle

a. Atributos
-idPedido: tipo entero
-idPedidoDetalle: tipo entero
-codigoProducto: tipo entero
-cantidad: tipo decimal
-precio: tipo de decimal
-Descuento: tipo decimal
-subtotal: tipo decimal
-total: tipo de dato decimal
b. Mtodos:
Constructor con o sin parmetros
Mtodo que permita validar que si el producto tiene existencia 0 no venda
Mtodo que valide cuando la cantidad es mayor a 4 que haga un descuento del 10%
Solucin:

Detalle:
/*
* 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 pedidos;

/**
*
* @author Onielosky
*/
public class Detalle {

private int idPedido;


private int idpedidodetalle;
private int codigoproducto;
private double precio;
private double descuento;
private double subtotal;
private double total;
private int existencia;

public Detalle()
{

public Detalle(int Pedidod


, int pedidodetalled
, int codigoproductod
, double preciod
, double descuentod
, double subtotald
, double totald
, int existenciad)
{
this.idPedido = Pedidod;
this.idpedidodetalle = pedidodetalled;
this.codigoproducto = codigoproductod;
this.precio = preciod;
this.descuento = descuentod;
this.subtotal = subtotald;
this.total = totald;
this.existencia = existenciad;
}
public void AsignarExistencia(int existenciarecibe)
{
this.existencia = existenciarecibe;
}

public boolean permiteventa ( int cantidad)


{
boolean blnpermiteventa;
if( cantidad <= existencia)
{
blnpermiteventa= true;
}
else
{
System.out.println( " no se puede vender, la cantidad Es Mayor a la
Existencia " + existencia);

blnpermiteventa = false;
}
return blnpermiteventa;
}

public void Aplicardescuento(int cantidad)


{
if ( cantidad >=4)
{
this.descuento = 10;
}
}

}
Encabezado:
/*
* 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 pedidos;

/**
*
* @author Onielosky
*/
public class Encabezado {

private int idpedido;


private int fecha;
private String nit;
private String Observacion;
private int fechasistema;
private boolean estado;

public Encabezado()
{

public Encabezado(int pedido


,int fechac
,String nitc
,String Observacionc
,int Fechasistema
,boolean estadoc)
{
this.idpedido = pedido;
this.fecha = fechac;
this.nit = nitc;
this.Observacion = Observacionc;
this.fechasistema = Fechasistema;
this.estado = estadoc;
}

public boolean validarFecha( int fechaCompara)


{
boolean esvalida;

if(fechaCompara >= fecha)


{
esvalida=true;
}
else
{
esvalida= false;
}
return esvalida;
}

public boolean Estado_Habilitar ( boolean blnActivar)


{
estado = blnActivar;
return estado;
}

Pedidos: (Main)
/*
* 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 pedidos;

/**
*
* @author onielosky
*/
public class Pedidos {

/**
* @param args the command line arguments
*/
public static void main(string[] args) {
// TODO code application logic here

Encabezado end = new Encabezado(1,10,"99","prueba",22,true);

end.validarfecha(10);
if( end.validarFecha(10))
{
System.out.println(" La Fecha ingreso es mayor a la del sistema");

else
{
system.out.println("fecha correcta");
}

Potrebbero piacerti anche