fini
This commit is contained in:
parent
d2341e4a24
commit
497a7f856b
6
DEV IHM/TP2/Synopsis.txt
Normal file
6
DEV IHM/TP2/Synopsis.txt
Normal file
@ -0,0 +1,6 @@
|
||||
Synopsis
|
||||
|
||||
le jardinier papé14 separe la partielle
|
||||
il observe la premiere moitier
|
||||
il separe la deuxieme parcelle
|
||||
il change d'avis et reunis les dexu sous parcelle
|
BIN
DEV3.2/Piles/Arithmetique/build/arithm.class
Normal file
BIN
DEV3.2/Piles/Arithmetique/build/arithm.class
Normal file
Binary file not shown.
44
DEV3.2/Piles/Arithmetique/src/arithm.java
Normal file
44
DEV3.2/Piles/Arithmetique/src/arithm.java
Normal file
@ -0,0 +1,44 @@
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class arithm {
|
||||
public static void main(String[] args) {
|
||||
Deque<Object> pile = new LinkedList<>();
|
||||
Object x;
|
||||
int a,b;
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
x = args[i];
|
||||
if (x == "+" || x == "-" || x == "/" || x == "*" )
|
||||
{
|
||||
switch (x) {
|
||||
case "+":
|
||||
a = (Integer) pile.pop();
|
||||
b = (Integer) pile.pop();
|
||||
pile.add(a+b);
|
||||
break;
|
||||
case "-":
|
||||
a = (Integer) pile.pop();
|
||||
b = (Integer) pile.pop();
|
||||
pile.add(a-b);
|
||||
break;
|
||||
case "/":
|
||||
a = (Integer) pile.pop();
|
||||
b = (Integer) pile.pop();
|
||||
pile.add(a/b);
|
||||
break;
|
||||
case "*":
|
||||
a = (Integer) pile.pop();
|
||||
b = (Integer) pile.pop();
|
||||
pile.add(a*b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pile.add(x);
|
||||
}
|
||||
}
|
||||
System.out.println("="+pile.pop());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user