1 package boletaventa213; 2 3 import java.io.BufferedReader; 4 import java.io.InputStreamReader; 5 import java.io.IOException; 6 import java.util.ArrayList; 7 8 public class BoletaVenta213 9 { 10 public static ArrayList<detalleBoleta> detabol = new ArrayList(); 11 public static void main(String[] args) throws IOException 12 { 13 String producto; 14 int codigo; 15 int precio; 16 int cantidad; 17 String op; 18 boletas bole = new boletas(1,"21-12-2011"); 19 20 BufferedReader tex = new BufferedReader(new InputStreamReader(System.in)); 21 System.out.println("-.SUPERMERCADOS LA TIJUANA.-"); 22 23 do{ 24 System.out.print("Ingrese código del producto: "); 25 codigo=Integer.parseInt(tex.readLine()); 26 27 System.out.print("Ingrese nombre del producto: "); 28 producto=tex.readLine(); 29 30 System.out.print("Ingrese precio del producto: "); 31 precio=Integer.parseInt(tex.readLine()); 32 System.out.print("Ingrese cantidad del producto: "); 33 cantidad=Integer.parseInt(tex.readLine()); 34 System.out.println(""); 35 36 System.out.print("desea agregar mas productos? s/n : "); 37 op=tex.readLine(); 38 System.out.println(""); 39 subAgregaProducto(codigo,producto,precio, bole, cantidad); 40 41 42 }while(op.equals("s")); 43 44 45 int i; 46 47 48 System.out.println("DETALLE DE LA BOLETA : "); 49 50 System.out.println(detabol.get(0).getBoleta().numero); 51 System.out.println(detabol.get(0).getBoleta().fecha); 52 System.out.println("Código Nombre PrecioUnitario Cantidad Precio "); 53 for (i=0;i<detabol.size();i++) 54 { 55 56 System.out.print(detabol.get(i).getProducto().codigo+" "); 57 System.out.print(" "); 58 System.out.print(detabol.get(i).getProducto().Nombre+" "); 59 System.out.print(" "); 60 System.out.print(detabol.get(i).getProducto().precioUnitario+" "); 61 System.out.print(" "); 62 System.out.print(detabol.get(i).cantidad+" "); 63 System.out.print(" "); 64 System.out.print(detabol.get(i).getProducto().precioUnitario* 65 detabol.get(i).cantidad); 66 System.out.println(""); 67 } 68 } 69 70 public static void subAgregaProducto(int codigo, String nombre, 71 int precio,boletas bole, 72 int cantidad) 73 { 74 productos prod = new productos(codigo,nombre,precio); 75 detabol.add(new detalleBoleta(bole, prod, cantidad)); 76 77 } 78 }
jueves, 27 de octubre de 2011
BoletaSupermercado - Objetos intermediarios
Clase principal
viernes, 21 de octubre de 2011
Presupuesto - Python
1 # -*- coding: utf-8 -*- 2 class ModeloDePresupuesto: 3 # Datos comerciales 4 titulo = "PRESUPUESTO" 5 encabezado_nombre = "Eugenia Bahit" 6 encabezado_web = "www.eugeniabahit.com.ar" 7 encabezado_email = "mail@mail.com" 8 9 # Datos impositivos 10 alicuota_iva = 21 11 12 # Propiedades relativas al formato 13 divline = "="*80 14 15 # Setear los datos del cliente 16 def set_cliente(self): 17 self.empresa = raw_input('\tEmpresa: ') 18 self.cliente = raw_input('\tNombre del cliente: ') 19 20 # Setear los datos básicos del presupuesto 21 def set_datos_basicos(self): 22 self.fecha = raw_input('\tFecha: ') 23 self.servicio = raw_input('\tDescripción del servicio: ') 24 importe = raw_input('\tImporte bruto: $') 25 self.importe = float(importe) 26 self.vencimiento = raw_input('\tFecha de caducidad: ') 27 28 # Calcular IVA 29 def calcular_iva(self): 30 self.monto_iva = self.importe*self.alicuota_iva/100 31 32 # Calcula el monto total del presupuesto 33 def calcular_neto(self): 34 self.neto = self.importe+self.monto_iva 35 36 # Armar el presupuesto 37 def armar_presupuesto(self): 38 """ 39 Esta función se encarga de armar todo el presupuesto 40 """ 41 txt = '\n'+self.divline+'\n' 42 txt += '\t'+self.encabezado_nombre+'\n' 43 txt += '\tWeb Site: '+self.encabezado_web+' | ' 44 txt += 'E-mail: '+self.encabezado_email+'\n' 45 txt += self.divline+'\n' 46 txt += '\t'+self.titulo+'\n' 47 txt += self.divline+'\n\n' 48 txt += '\tFecha: '+self.fecha+'\n' 49 txt += '\tEmpresa: '+self.empresa+'\n' 50 txt += '\tCliente: '+self.cliente+'\n' 51 txt += self.divline+'\n\n' 52 txt += '\tDetalle del servicio:\n' 53 txt += '\t'+self.servicio+'\n\n' 54 txt += '\tImporte: $%0.2f | IVA: $%0.2f\n' % ( 55 self.importe, self.monto_iva) 56 txt += '-'*80 57 txt += '\n\tMONTO TOTAL: $%0.2f\n' % (self.neto) 58 txt += self.divline+'\n' 59 print txt 60 61 # Método constructor 62 def __init__(self): 63 print self.divline 64 print "\tGENERACIÓN DEL PRESUPUESTO" 65 print self.divline 66 self.set_cliente() 67 self.set_datos_basicos() 68 self.calcular_iva() 69 self.calcular_neto() 70 self.armar_presupuesto() 71 72 # Instanciar clase 73 presupuesto = ModeloDePresupuesto()
Mover objeto - ActionScript 3
1 package { 2 3 import flash.display.MovieClip; 4 5 6 public class main extends MovieClip { 7 8 public var pelota1:pelota; 9 10 public function main() { 11 pelota1=new pelota(); 12 pelota1.cambioXY(); 13 //pelota1.escuchador(); 14 15 addChild(pelota1); 16 pelota1.escuchador2(); 17 } 18 } 19 20 }
Arreglos - Java
1 package arreglos; 2 import java.io.*; 3 4 public class Main { 5 6 public static void main(String[] args)throws IOException { 7 String arreglo[]= new String [20]; 8 9 arreglo[1]= "hola como estas"; 10 arreglo [2]= "bien y tu"; 11 System.out.println(arreglo[1]); 12 String palabras="hola como estas"; 13 System.out.println(palabras); 14 String mio[]= new String[palabras.length()]; 15 for(int i =0;i<palabras.length();i++){ 16 mio[i]=palabras.substring(i,i+1); 17 System.out.print(mio[i]); 18 } 19 System.out.println("\n"); 20 String Texto; 21 //crear un programa que lea numero determinado de numeros 22 //y que imprima el promedio de numeros 23 //la condicion de termino es cuando numero = 0 24 System.out.println("Ingrese los numeros que desea promediar"); 25 InputStreamReader IRS = new InputStreamReader(System.in); 26 BufferedReader tex =new BufferedReader(IRS); 27 Texto= tex.readLine(); 28 String arreglin[]= new String[Texto.length()]; 29 Integer num[]=new Integer[Texto.length()]; 30 int acu=0; 31 for(int i=0;i<Texto.length();i++){ 32 33 arreglin[i]=Texto.substring(i,i+1); 34 35 } 36 37 for(int i=0;i<Texto.length();i++){ 38 39 num[i]=Integer.parseInt(arreglin[i]); 40 } 41 for(int i=0;i<Texto.length();i++){ 42 acu = acu+num[i]; 43 } 44 System.out.println(acu/Texto.length()); 45 int acum=0; 46 int cont = 0; 47 System.out.println("nuevo"); 48 Integer nume=0; 49 Texto=""; 50 do{ 51 52 Texto = tex.readLine(); 53 54 cont++; 55 nume = Integer.parseInt(Texto); 56 acum= acum+nume; 57 58 59 60 }while(nume==0); 61 System.out.println(acu/(cont-1)); 62 63 64 65 66 } 67 68 }
Mayúsculas Minúsculas - Java
1 package mayusculasminusculas; 2 3 import java.io.BufferedReader; 4 import java.io.IOException; 5 import java.io.InputStreamReader; 6 7 8 public class MayusculasMinusculas 9 { 10 public static void main(String[] args) throws IOException 11 { 12 String texto; 13 String texto_aux=""; 14 int i; 15 16 InputStreamReader ISR = new InputStreamReader(System.in); 17 BufferedReader bftexto = new BufferedReader(ISR); 18 19 texto = bftexto.readLine(); 20 21 System.out.println("En mayusculas "+texto.toUpperCase()); 22 System.out.println("En minusculas "+texto.toLowerCase()); 23 24 for (i=0;i<texto.length();i++) 25 texto_aux = texto_aux + texto.toUpperCase().charAt(i); 26 27 System.out.println("En mayusculas "+texto_aux); 28 29 texto_aux = ""; 30 for (i=0;i<texto.length();i++) 31 texto_aux = texto_aux + texto.toLowerCase().charAt(i); 32 33 System.out.println("En minusculas "+texto_aux); 34 35 texto_aux = ""; 36 for (i=0;i<texto.length();i++) 37 if (Character.isUpperCase(texto.charAt(i))) 38 texto_aux = texto_aux + texto.toLowerCase().charAt(i); 39 else 40 texto_aux = texto_aux + texto.toUpperCase().charAt(i); 41 42 System.out.println("Case cambiado "+texto_aux); 43 44 texto_aux = ""; 45 for (i=0;i<texto.length();i++) 46 if (esVocal(texto.charAt(i))) 47 texto_aux = texto_aux + texto.toUpperCase().charAt(i); 48 else 49 texto_aux = texto_aux + texto.toLowerCase().charAt(i); 50 51 System.out.println("Case cambiado "+texto_aux); 52 53 54 55 } 56 57 public static Boolean esVocal(Character caracter) 58 { 59 String vocales = "aeiouAEIOU"; 60 61 if (vocales.indexOf(caracter)==-1) 62 return false; 63 else 64 return true; 65 } 66 }
Cajero Automático - Java
1 2 package cajeroautomatico; 3 import java.io.BufferedReader; 4 import java.io.InputStreamReader; 5 import java.io.IOException; 6 import javax.swing.*; 7 import java.awt.event.*; 8 9 public class CajeroAutomatico { 10 11 12 public static void main(String[] args)throws IOException { 13 int op; 14 String letra; 15 int resp=0; 16 System.out.println("----------------------------"); 17 System.out.println("| CAJERO AUTOMATICO 2.0 | "); 18 System.out.println("----------------------------"); 19 Cajero saldos = new Cajero(0,0,0,0,0); 20 do{ 21 22 System.out.println("1.- Depositar"); 23 System.out.println("2.- Girar"); 24 System.out.println("3.- ver monto"); 25 System.out.println("4.- Salir"); 26 BufferedReader tex = new BufferedReader(new InputStreamReader(System.in)); 27 System.out.println(""); 28 System.out.print("Ingrese su opcion a realizar: "); 29 letra=tex.readLine();//lee la opción elegida 30 resp=Proceso(saldos,letra,resp);//llama a la funcion Proceso y retorna una respuesta 31 32 33 System.out.println(""); 34 35 }while(!letra.equals("4"));//si la opcion es 4 el programa termina 36 37 38 39 } 40 public static int Proceso(Cajero cajero1, String A, int resp)throws IOException{ 41 String bill;//String para leer la cantidad de billetes 42 int total=0;//el total de todos los billetes ingresados || y tambien para restar cuando existe giro 43 int cant; 44 int sob=0; 45 BufferedReader tex = new BufferedReader(new InputStreamReader(System.in)); 46 47 if(A.equals("1")){ 48 try{ 49 System.out.println("Ingrese el monto a depositar: "); 50 System.out.print("Cantidad en billetes de 20 mil: "); 51 bill=tex.readLine(); 52 cant=Integer.parseInt(bill); 53 cajero1.setBill20(cant*20000); 54 System.out.print("Cantidad en billetes de 10 mil: "); 55 bill=tex.readLine(); 56 cant=Integer.parseInt(bill); 57 cajero1.setBill10(cant*10000); 58 System.out.print("Cantidad en billetes de 5 mil: "); 59 bill=tex.readLine(); 60 cant=Integer.parseInt(bill); 61 cajero1.setBill5(cant*5000); 62 System.out.print("Cantidad en billetes de 2 mil: "); 63 bill=tex.readLine(); 64 cant=Integer.parseInt(bill); 65 cajero1.setBill2(cant*2000); 66 System.out.print("Cantidad en billetes de mil: "); 67 bill=tex.readLine(); 68 cant=Integer.parseInt(bill); 69 cajero1.setBill1(cant*1000); 70 total=cajero1.bill20+cajero1.bill10+cajero1.bill5+cajero1.bill2+cajero1.bill1; 71 }catch(NumberFormatException a){ 72 System.out.println("Solo ingrese numeros!!!"); 73 } 74 }else if(A.equals("3")){ 75 System.out.println("El saldo es: "); 76 System.out.println("En billetes de 20 mil: "+cajero1.getBill20()); 77 System.out.println("En billetes de 10 mil: "+cajero1.getBill10()); 78 System.out.println("En billetes de 5 mil: "+cajero1.getBill5()); 79 System.out.println("En billetes de 2 mil: "+cajero1.getBill2()); 80 System.out.println("En billetes de 1 mil: "+cajero1.getBill1()); 81 82 System.out.println("El total es: "+(cajero1.bill20+cajero1.bill10+cajero1.bill5+cajero1.bill2+cajero1.bill1)); 83 }else if(A.equals("2")){ 84 System.out.println("¿Cuanto dinero desea retirar?: "); 85 System.out.println("Cantidad de dinero del cajero $"+(cajero1.bill20+cajero1.bill10+cajero1.bill5+cajero1.bill2+cajero1.bill1)); 86 bill=tex.readLine(); 87 System.out.println(""); 88 cant=Integer.parseInt(bill); 89 if(cant>(cajero1.bill20+cajero1.bill10+cajero1.bill5+cajero1.bill2+cajero1.bill1)){ 90 System.out.println("El monto excede el maximo de giro..."); 91 92 }else 93 System.out.print("A usted se le hará entrega de: "); 94 if(cant>=20000){ 95 total=cant/20000; 96 resp=total*20000; 97 if(resp<=cajero1.getBill20()){ 98 cajero1.setBill20(cajero1.getBill20()-resp); 99 cant=cant-resp;} 100 else {cant=cant-cajero1.getBill20();} 101 System.out.print(total+" billetes de $20.000 = "+resp+" ,"); 102 } 103 if(cant>=10000){ 104 total=cant/10000; 105 resp=total*10000; 106 cajero1.setBill10(cajero1.getBill10()-resp); 107 cant=cant-resp; 108 System.out.println(total+" billetes de $10.000 = "+resp+" ,"); 109 } 110 if(cant>=5000){ 111 total=cant/5000; 112 resp=total*5000; 113 cajero1.setBill5(cajero1.getBill5()-resp); 114 cant=cant-resp; 115 System.out.print(total+" billetes de $5.000 = "+resp+" ,"); 116 } 117 if(cant>=2000){ 118 total=cant/2000; 119 resp=total*2000; 120 cajero1.setBill2(cajero1.getBill2()-resp); 121 cant=cant-resp; 122 System.out.print(total+" billetes de $2.000 = "+resp+" ,"); 123 } 124 125 if(cant>=1000){ 126 total=cant/1000; 127 resp=total*1000; 128 cajero1.setBill1(cajero1.getBill1()-resp); 129 cant=cant-resp; 130 System.out.print(total+" billetes de $1.000 = "+resp+" "); 131 } 132 133 134 135 136 } 137 138 139 140 141 142 return total; 143 } 144 }
Suscribirse a:
Entradas (Atom)