martes, 5 de septiembre de 2017

/*
 * 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 poo_mj_interfas;

import java.util.Scanner;

/**
 *
 * @author SEDUCA
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
       
        Producto mouse=new Producto("Mouse",200);
        System.out.println(mouse.calcularPrecioFinal());
        System.out.println("El Iva es:" + mouse.calcularIva());
        System.out.println("El Deuda es:" + mouse.calcularDeuda());
        mouse.informarProducto();
    }
   
}
*******************************
/*
 * 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 poo_mj_interfas;

/**
 *
 * @author SEDUCA
 */
public class Producto implements Contable {
    private String producto;
    private double costo;
   
    public Producto(String producto,double costo){
    this.producto=producto;
    this.costo=costo;
    }
    //implementacion de los metodos adstractos:
    @Override
    public double calcularIva(){
    return calcularPrecioFinal()*IVA;
    }
    @Override
    public double calcularPrecioFinal(){
    return calcularPrecio()+calcularPrecio()*IVA;
    }
   
    @Override
    public double calcularDeuda(){
    return calcularPrecio()+calcularPrecio()*DEUDA;
    }
   
   
   
    //Metodo privados:
    private double calcularPrecio(){
    return (double)(this.costo+this.costo*GANANCIA);
    }

    @Override /// este proceso con la palabra void hace un proceso.
    public void informarProducto() {
        System.out.println("Este Producto es:" +this.producto);
    }
   
    
}
*****************************
/*
 * 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 poo_mj_interfas;

/**
 *
 * @author SEDUCA
 */
public interface Contable {
    //CONSTANTES:
    public final double IVA=0.21;
    public final double GANANCIA=0.5;
    public final double DEUDA=0.2;
   
    //METODOS ABSTRACTOS:
    public double calcularPrecioFinal();
    public double calcularIva();
    public double calcularDeuda();
    public void informarProducto();
   
}

No hay comentarios:

Publicar un comentario

Los mail de oulook no se pueden reenviar.

 cuando en el asunto poseen un caracter especial por ejemplo @#$ los correos no salen y no te muestra ningun correo de rebote, especialmente...