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

/**
 *
 * @author felix
 */
public class Partida {
    private Producto elProducto;
    private int cantidad;
    
    Partida(Producto unProducto, int unaCantidad) {
        elProducto = unProducto;
        cantidad = unaCantidad;
    }
    
    public double obtenPrecioTotal() {
        return elProducto.getPrecio()*cantidad;
    }
    
    public String formato(){
        return String.format("%-30s %12.2f %5d %12.2f",
                elProducto.getDescripcion(), 
                elProducto.getPrecio(), cantidad,
                obtenPrecioTotal());
    }
    
    @Override
    public String toString() {
        return formato();
    }
}
