TestGeometrique.java 839 Bytes
import java.util.*;

public class TestGeometrique {
    
    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();
        ProgressionGeometrique pg = new ProgressionGeometrique(d,raison);
        
        System.out.print("\nnext (y/n)? ");
        char next = sc.next().charAt(0);
        while(next == 'y'){
            pg.next();
            System.out.println("\n-> "+pg.getTerme());
            
            System.out.print("next (y/n)? ");
            next = sc.next().charAt(0);
        }
        System.out.print("\nnb termes supplementaires? ");
        pg.next(sc.nextInt());
        System.out.println("\n"+pg.toString());
    }
}