Blame view

tp3_polymorph/tp3/geometric/TestGeometrique.java 839 Bytes
fed1c83c   Vincent Benoist   tp2 et 3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  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());
      }
  }