Advertisement
Guest User

Untitled

a guest
May 24th, 2017
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 2.50 KB | None | 0 0
  1. *
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. package pruebita;
  7. import java.util.*;
  8. /**
  9.  *
  10.  * @author profesor
  11.  */
  12. public class Factura {
  13.    
  14.     static Scanner entrada = new Scanner(System.in);
  15.  
  16.     public static void main(String[] args){
  17.         String prod,nombre;
  18.         double precio=0.00,importe,subtotal,total,igv;
  19.         int cantidad;
  20.  
  21.         nombre=entrada.nextLine();
  22.         System.out.println("Producto: ");
  23.         prod=entrada.nextLine();
  24.         System.out.println("Cantidad: ");
  25.         cantidad=entrada.nextInt();
  26.  
  27.         if(prod.equals("Camisas")){
  28.             precio=30.00;
  29.         }else if(prod.equals("Polos")){
  30.             precio=25.00;
  31.         }else if(prod.equals("Pantalones")){
  32.             precio=65.00;
  33.         }else{
  34.             precio=0.00;
  35.         }
  36.  
  37.         importe = precio*cantidad;
  38.         subtotal=importe;
  39.         igv=subtotal*0.19;
  40.         total=subtotal+igv;
  41.  
  42.         Calendar f= Calendar.getInstance();
  43.         int d=f.get(Calendar.DAY_OF_MONTH);
  44.         int m=f.get(Calendar.MONTH);
  45.         int y=f.get(Calendar.YEAR);
  46.  
  47.         String fecha= d +"/"+(m+1)+"/"+y;
  48.        
  49.  
  50.         System.out.println("+-------------------------------------------------+");
  51.         System.out.println("|FACTURA                      |");
  52.         System.out.println("+-------------------------------------------------+");
  53.         System.out.println("|Cliente: "+nombre+"           Fecha: "+fecha+" |");
  54.         System.out.println("+====+==========================+=======+=========+");
  55.         System.out.println("|Cant|  Detalle    |  P.U. | Importe |");
  56.         System.out.println("+----+--------------------------+-------+---------+");
  57.         System.out.println("| "+cantidad+" | "+prod+"             |  "+precio+" |  "+importe+"  |");
  58.         System.out.println("|    |                          |       |         |");
  59.         System.out.println("|    |                          |       |         |");
  60.         System.out.println("+----+--------------------------+-------+---------+");
  61.         System.out.println("|                 Subtotal:|  "+subtotal+"  |");
  62.         System.out.println("+---------------------------------------+---------+");
  63.         System.out.println("|                  IGV:|  "+igv+"  |");
  64.         System.out.println("+---------------------------------------+---------+");
  65.         System.out.println("|               Total:|  "+total+"  |");
  66.         System.out.println("+---------------------------------------+---------+");
  67.  
  68.  
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement