Bonjour tout le monde,

voici mon programme :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
 
public class Complex 
{
    double reel, imag;
    static double zfin;
    public Complex()
 
    {
        this.reel=0;
        this.imag=0;
    }
    public Complex(double reel, double imag)
    {
        this.reel=reel;
        this.imag=imag;
    }
    public Complex(double reel)
    {
        this.reel=reel;
        this.imag=0;
    }
    public Complex plus(Complex z)
    {
 
        return new Complex (this.reel+z.reel,this.imag+z.imag);
 
    }
    public static Complex plusStat(Complex z1, Complex z2)
    {
        Complex z= new Complex(z1.reel+z2.reel,z1.imag+z2.imag);
 
            return z;    
    }
    public static void main(String [] args)
    {
        Complex z1= new Complex(12,7);
        Complex z2 = new Complex(7,14);
 
        z1.plus(z2);
        System.out.println("z1 plus z2 est égale à : "+z.reel+ " " +z.imag);
        System.out.print("\n");
        z2.plus(z1);
        System.out.println("z2 plus z1 est égale à : "+z.reel+ " " +z.imag);
        System.out.print("\n");
        plusStat(z1,z2);
        System.out.println("l'addition des complex z1 et z2 est égale à : "+z.reel+ " " +z.imag);
 
    }
 
}
Son objetif est de faire une addition de complexe en se servant d'objet, la structure du programme et globalement déterminer par l'énoncer.

Je souhaite afficher lee résultat de z1.plus(z2),z2.plus(z1) et de plusStat(z1,z2) mais je ne vois pas comment faire, ou si il y a un problème dans ma déclaration des constructeurs. Si vous avez une idée je suis preneur.