Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package ed_ficha4;
- import java.util.Iterator;
- /**
- *
- * @author nuno_
- */
- public class DezReaisMutavel extends DezReais implements Iterable<Double>{
- private final int TAMANHO = 10;
- private Double []tab = new Double[TAMANHO];
- private int last = 0;
- private int modificacoes = 0;
- public void remove(int pos){
- int j;
- modificacoes ++;
- System.out.println("last: " + last + " pos: " + pos);
- for (j = pos ; j < last - 1; j++){
- tab[j] = tab[j+1];
- }
- last--;
- }
- public void acrescenta(Double valor){
- modificacoes++;
- add(valor);
- }
- public int getModificacoes (){return modificacoes;}
- @Override
- public Iterator<Double> iterator() {
- return new ItDezReaisMutavel(this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement