Salve sono nuovo del forum
sto cercando di implementare un programma in java, ho un problema quando cerco di decrementare, esempio.
programma Bancomat:
inserisco un prelievo-
il programma decrementa un campo importo ( l'importo mensile max per quella carta di credito ) ma quando richiedo un altro prelievo invece di prendere l'ultimo valore ( quello decrementato ) riprende il valore settato all'inizio: questo è il codice con classe:

codice:
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;

public class Main {

	static HashMap<String, Carta> listaCarte = new HashMap<String, Carta>();
	static LinkedList listaOperazioni = new LinkedList();
	
	static Carta nuovaCarta ;
	LimiteRaggiunto lim = new LimiteRaggiunto();
	
	    public static void main(String args[]) throws Exception {
	        String scelta = "";
	    	boolean b = true;
			String[] buffer ;
			
	    	while(b){
	    		System.out.println("\n\n**** inserisci la tua scelta ****");
	    		System.out.println("P <data> <numeroCarta> <valore>");
	    		System.out.println("N <numeroConto> ");
	    		System.out.println("I <cognomeIntestatario> ");
	    		System.out.println("A cancella la lista dei prelievi");
	    		System.out.println("T fine programma");
	    		
	    		scelta = leggi();
	    		buffer = scelta.split(" ");
	    		
	    		// caricamento dei 2 file di testo utenti.txt e carte.txt
	    		try{
    				leggifile1();
    				}catch(IOException e){
    					System.out.println("Errore in apertura file: "+e);
    				}
	    	    
    			try{
	    				leggifile2();
	    			}catch(IOException e){
	    				System.out.println("Errore in apertura file: "+e);
	    			}
	    		
	    		// controllo cosa ha scelto l'utente
	    		if(buffer[0].equals("P")){
	    			System.out.println("Hai scelto: "+buffer[0]);
	    			System.out.println("data: "+buffer[1]);
	    			System.out.println("numero carta: "+buffer[2]);
	    			System.out.println("valore: "+buffer[3]);
	    			
	    			prelievo(buffer[1],buffer[2],buffer[3]);
	    		}
	    		else if(buffer[0].equals("N")){
	    			System.out.println("Hai scelto: "+buffer[0]); 			
	    			
	    		}
	    		
	    		else if(buffer[0].equals("I")){
	    			System.out.println("Hai scelto: "+buffer[0]);
	    			b = false;
	    		}
	    		else if(buffer[0].equals("A")){
	    			System.out.println("Hai scelto: "+buffer[0]);
	    			b = false;
	    		}
	    		else if(buffer[0].equals("T")){
	    			System.out.println("Hai scelto: "+buffer[0]);
	    			b = false;
	    		}
	    		
	    		else System.out.println("Hai sbagliato, riprova"); 
	    	}
	    	
		/*	do{
				System.out.println("***** MENU *****");
				System.out.println("1-- Carica file utenti");
				System.out.println("2-- Carica file carte");
				System.out.println("3-- Salva risultati gruppo-quantitÃ*");
				System.out.println("4-- Salva risultati gruppo-donatori");
				System.out.println("5-- Salva riusltati donatori-donazioni");
				System.out.println("0-- ESCI SENZA SALVARE");
				
				scelta= (Integer.valueOf(leggi()).intValue());
				
				switch(scelta){
				case 1:
					try{
						leggifile1();
					}catch(Exception e){
						System.out.println("Errore nel caricamento, controlla i campi del file");
					}
					break;
					
				case 2:
					try{
						leggifile2();
					}catch(Exception e){
						System.out.println("Errore nel caricamento, controlla i campi del secondo file");
					}
					break;
					
				case 3:
					
				default:
					System.out.println("Errore nella scelta");
				}
				
			}while(scelta!=0);
			*/
		}
	    
	    
	    /******* LEGGI FILE 1 *********/
		public static void leggifile1()throws IOException, FileNotFoundException, DatoMancante{
			// System.out.println("Inserisci il nome del file  es.: utenti.txt");

			// prende il nome inserito da tastiera dalla funzione leggi()
			// String nomefile = leggi();
			String b;
			
			BufferedReader bufr = new BufferedReader(new FileReader("utenti.txt"));
			b = bufr.readLine();
			String numeroConto;
			String cognomeIntestatario = null;
			String numeroCarta = null;
			
			while( b != null){
				StringTokenizer st = new StringTokenizer(b);
				if( st.countTokens() != 3) throw new DatoMancante(); // eccezione
				
				while(st.hasMoreTokens()){
					
					numeroConto= st.nextToken();
					cognomeIntestatario = st.nextToken();
					numeroCarta = st.nextToken();
					
				    nuovaCarta = new Carta (numeroCarta,numeroConto,cognomeIntestatario,0f);
						listaCarte.put(numeroCarta,nuovaCarta);
						
						
					}
			//	System.out.println("\n Caricato file utenti.txt con: "+numeroCarta+" "+cognomeIntestatario+" "+numeroCarta);
				b = bufr.readLine();
			}
			bufr.close(); // chiusura del buffer
		}
		
		
		/******* LEGGI FILE 2 *********/
		public static void leggifile2()throws IOException, FileNotFoundException, DatoMancante{
			// System.out.println("Inserisci il nome del file  es.: carte.txt");

			// prende il nome inserito da tastiera dalla funzione leggi()
			// String nomefile = leggi();
			String b;
			
			BufferedReader bufr = new BufferedReader(new FileReader("carte.txt"));
			b = bufr.readLine();
			String numeroCarta = null;
			float limite = 0 ;
			
			while( b != null){
				StringTokenizer st = new StringTokenizer(b);
				if( st.countTokens() != 2) throw new DatoMancante(); // eccezione
				
				while(st.hasMoreTokens()){
				
					numeroCarta = st.nextToken();
					limite = Float.parseFloat(st.nextToken());
					
					if(listaCarte.containsKey(numeroCarta)){
						Carta app = (Carta) listaCarte.get(numeroCarta);
						app.setLimite(limite);	
						
					}
					else System.out.println("\n Errorre nella ricerca della carta!!\n Carta non trovata!\n");
						
				}
		//		System.out.println("\n Caricato file carte.txt con: "+numeroCarta+" "+limite+"\n\n");
				b = bufr.readLine();
			}
			bufr.close(); // chiusura del buffer
		}
		
		/********* controllo limite *****/
		public static void prelievo(String data, String numCarta, String valore)throws LimiteRaggiunto{
						
			/* controllo la stringa inserita: data - numerocarta - valore */
			
			String dataPresa= get_data(data);
		//	get_carta(numCarta);
		//	get_valore(valore);
			float val = Float.parseFloat(valore);				
			
			// prelevo i dati della carta e controllo se il limite è raggiunto
			
			 System.out.println("\n\n cerco il limite della carta:");
		        Carta c = listaCarte.get(numCarta);
		        if (c != null)
		        {
		            System.out.println("Limite attuale: " + c.get_limite());
		        }
			

		        // decremento il limite con il nuovo prelievo
		      try{
		       if( c.dec_limite(val) < 0)throw new LimiteRaggiunto();
		       
		         
		         System.out.println("Nuovo limite: "+c.get_limite()+" sono stati prelevati: "+valore);
		         Operazione op = new Operazione(dataPresa,val);
		         listaOperazioni.add(op);       
		         
		       }catch(LimiteRaggiunto e){
		    	 // stampa delle operazioni
			         Iterator it = listaOperazioni.iterator();
			         while(it.hasNext()){
			        	 Operazione app = (Operazione)it.next();			        	 
			        	 System.out.println("\n Il limite è stato superato \n queste le operazioni fatte \n Operazione: "+app.get_operazione());
			         }
		       }
		         
			// stampa dei numero carte
/*			while(it.hasNext()){
				String app = (String)it.next();
				if(app.equals(numCarta)){					
					System.out.println("Carta presente :"+numCarta);
				}
				//System.out.println("\n\n Tutte le carte inserite nella mappa: "+it.next());
			}
			
			// stampa delle carte
			
			while(it1.hasNext()){
				Carta app = (Carta)it1.next();
				System.out.println("Le carte: "+app.ToString());
			}
	*/		
	
			
			}
		
		
	/*	private static void get_valore(String valore) {
			
		}


		private static void get_carta(String numCarta) {
			
		}
*/

		/*********** DATA *****************/
		public static String get_data(String data){
			StringTokenizer st = new StringTokenizer(data, "."+":");
			String dataN = null;
			while (st.hasMoreTokens()){			
				 // data
				int gg = Integer.parseInt(st.nextToken());
				int mm = (Integer.parseInt(st.nextToken())-1);
				int an = Integer.parseInt(st.nextToken());
				int h = Integer.parseInt(st.nextToken());
				int m = Integer.parseInt(st.nextToken());
				int s = Integer.parseInt(st.nextToken());
			
				// controllo della data
				SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy - HH:mm:ss");
				GregorianCalendar gc1 = new GregorianCalendar(an,mm,gg,h,m,s);
				
				dataN = "\n\n Data letta: "+sdf.format(gc1.getTime());
		
			}
			return dataN;
		}
		
		
		/************* METODO LEGGI ***************/
		/******** lettura dalla tastiera *********/
		public static String leggi(){
			InputStreamReader in = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(in);
			String stringa = new String();
			
			try{			
				stringa = br.readLine();
				return stringa;
			}catch(Exception e){
				System.out.println("\n\n Errore: "+e+" nella lettura da tastiera ");
				System.exit(0);
				return("ERRORE");
			}
		}
	    
}
Mentre la classe Carte, quella a cui fa riferimento è questa:

codice:
import java.io.*;
import java.util.*;

public class Carta {

	private String numeroCarta;
	private float limite=0;
	private String cognomeIntestatario;
	private String numeroConto;
	
	
	LinkedList listaOperazioni = new LinkedList();
	
	public Carta(String numeroCarta, String numeroConto, String cognomeIntestatario, float limite){
		this.numeroCarta = numeroCarta;
		this.numeroConto = numeroConto;
		this.cognomeIntestatario = cognomeIntestatario;
		this.limite = limite;
		listaOperazioni.add(numeroCarta);
	}
	

	public String get_intestatario(){
		return cognomeIntestatario;
	}
	
	public void setLimite(float lim){
		limite = lim;
	}
	
	public float dec_limite(float val) {
		this.limite = this.limite-val;
		return limite;
	}
	
	public float get_limite(){
		return this.limite;
	}
	
	public String ToString(){
		return "\n\n Cognome: "+cognomeIntestatario+"\n Numero Conto: "+numeroConto+"\n Numero Carta: "+numeroCarta+"\n Limite: "+limite;
	}
	
	public void stampa_operazioni(){
		Iterator it = listaOperazioni.iterator();
		while(it.hasNext()){
			System.out.println("Operazioni: "+(String) it.next());
		}
		
	}
	
	public void reset_operazioni(){
		listaOperazioni.clear();
	}

	
}
qualcuno riesce a capire come mai?
forse errore nella HashMap oppure nei metodi della classe Carte??

Grazie in anticipo