Advertisement
Guest User

ProductClass1

a guest
Nov 28th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2.  
  3. public class Producto {
  4.    
  5.     public static void main(String[]arg) {
  6.         System.out.println("Programa Producto: ");
  7.         String Nom = " ";
  8.         double valor=0, desc=1 , iva=16, total=0, subtotal=0;
  9.         int cant=0;
  10.         InputStreamReader fila= new InputStreamReader (System.in);
  11.         BufferedReader leer= new BufferedReader (fila);
  12.         try {System.out.print("Digite el nombre del producto: ");
  13.          Nom = leer.readLine();
  14.          System.out.print("Ingrese el valor: ");
  15.          valor= Double.parseDouble(leer.readLine());
  16.          System.out.print("Cantidad a comprar: ");
  17.          cant= Integer.parseInt(leer.readLine());
  18.         }catch(IOException e) {}
  19.         subtotal= valor*cant;
  20.         subtotal= subtotal + subtotal*desc/100;
  21.         total= subtotal+subtotal*iva/100;
  22.       System.out.println("La factura es: ");
  23.       System.out.println("Nombre: "+ Nom);
  24.       System.out.println("Subtotal: "+ subtotal);
  25.       System.out.println("Total a pagar: " + total);
  26.         }
  27.        
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement