Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package pruebita;
- import java.util.*;
- /**
- *
- * @author profesor
- */
- public class Factura {
- static Scanner entrada = new Scanner(System.in);
- public static void main(String[] args){
- String prod,nombre;
- double precio=0.00,importe,subtotal,total,igv;
- int cantidad;
- nombre=entrada.nextLine();
- System.out.println("Producto: ");
- prod=entrada.nextLine();
- System.out.println("Cantidad: ");
- cantidad=entrada.nextInt();
- if(prod.equals("Camisas")){
- precio=30.00;
- }else if(prod.equals("Polos")){
- precio=25.00;
- }else if(prod.equals("Pantalones")){
- precio=65.00;
- }else{
- precio=0.00;
- }
- importe = precio*cantidad;
- subtotal=importe;
- igv=subtotal*0.19;
- total=subtotal+igv;
- Calendar f= Calendar.getInstance();
- int d=f.get(Calendar.DAY_OF_MONTH);
- int m=f.get(Calendar.MONTH);
- int y=f.get(Calendar.YEAR);
- String fecha= d +"/"+(m+1)+"/"+y;
- System.out.println("+-------------------------------------------------+");
- System.out.println("|FACTURA |");
- System.out.println("+-------------------------------------------------+");
- System.out.println("|Cliente: "+nombre+" Fecha: "+fecha+" |");
- System.out.println("+====+==========================+=======+=========+");
- System.out.println("|Cant| Detalle | P.U. | Importe |");
- System.out.println("+----+--------------------------+-------+---------+");
- System.out.println("| "+cantidad+" | "+prod+" | "+precio+" | "+importe+" |");
- System.out.println("| | | | |");
- System.out.println("| | | | |");
- System.out.println("+----+--------------------------+-------+---------+");
- System.out.println("| Subtotal:| "+subtotal+" |");
- System.out.println("+---------------------------------------+---------+");
- System.out.println("| IGV:| "+igv+" |");
- System.out.println("+---------------------------------------+---------+");
- System.out.println("| Total:| "+total+" |");
- System.out.println("+---------------------------------------+---------+");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement