49443da5
Vincent Benoist
tp avance
|
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 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());
}
}
|