From 9fe033ea88c2f705ec18c232873d056e0c229d72 Mon Sep 17 00:00:00 2001 From: Gaspard Coulet Date: Wed, 28 Apr 2021 23:05:53 +0200 Subject: Initial commit --- sem_5/HLIN505_Java/HLIN505/src/foobar/SUT.java | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sem_5/HLIN505_Java/HLIN505/src/foobar/SUT.java (limited to 'sem_5/HLIN505_Java/HLIN505/src/foobar/SUT.java') diff --git a/sem_5/HLIN505_Java/HLIN505/src/foobar/SUT.java b/sem_5/HLIN505_Java/HLIN505/src/foobar/SUT.java new file mode 100644 index 0000000..7d29953 --- /dev/null +++ b/sem_5/HLIN505_Java/HLIN505/src/foobar/SUT.java @@ -0,0 +1,48 @@ +package foobar; + +public class SUT { + private int x; + private int y; + private int z; + + public SUT(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + public SUT(){ + x=1; + y=3; + z=5; + } + + /** + * Si t est strictement plus petit que x, on retourne x, sinon si t est strictement plus grand que z, on retourne z, sinon on retourne y. + * @param t un entier quelconque + * @return x si tz, y sinon + */ + public int foo(int t){ + int resultat=0; + if (tz) resultat=z; + else resultat=y; + return resultat; + } + + /** + * décale circulairement les valeurs de x, y et z : x prend la valeur de y, y prend la valeur de z et z prend la valeur de x + */ + public void bar(){ + int temp=x; + x=y; + y=z; + z=temp; + } + + /** + * + */ + public void foobar()throws FooBarException{ + if (x<0) throw new FooBarException(); + } +} -- cgit v1.2.3