TestArithmetique.java 842 Bytes
import java.util.*;

public class TestArithmetique {
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        System.out.print("\npremier terme? ");
        double d = sc.nextDouble();
        System.out.print("\nraison? ");
        double raison = sc.nextDouble();
        ProgressionArithmetique pa = new ProgressionArithmetique(d,raison);
        
        System.out.print("\nnext (y/n)? ");
        char next = sc.next().charAt(0);
        while(next == 'y'){
            pa.next();
            System.out.println("\n-> "+pa.getTerme());
            
            System.out.print("next (y/n)? ");
            next = sc.next().charAt(0);
        }
        System.out.print("\nnb termes supplementaires? ");
        pa.next(sc.nextInt());
        System.out.println("\n"+pa.toString());
    }
}