Java help-Main method not found in class via /r/learnprogramming


Java help-Main method not found in class

 public class Complex{ double x, y; Complex(double a, double b){ x = a; y = b; } Complex(double a){ x = a; y = 0; } Complex(){ x = 0; y = 0; } double getRealPart(){ return x; } double getImaginaryPart(){ return y; } Complex add(Complex Q){ Complex addResult = new Complex(x + Q.x, y + Q.y); return addResult; } Complex subtract(Complex Q){ Complex subResult = new Complex(x - Q.x, y - Q.y); return subResult; } Complex multiply(Complex Q){ Complex mulResult = new Complex(x * Q.x - y * Q.y, y * Q.x + x * Q.y); return mulResult; } Complex divide(Complex Q){ Complex divResult = new Complex((x * Q.x + y * Q.y) / (Q.x * Q.x + Q.y * Q.y), (y * Q.x - x * Q.y) / (Q.x * Q.x + Q.y * Q.y)); return divResult; } double abs(){ return Math.sqrt(x * x + y * y); } public String toString(){ if(y == 0) return "" + x; else return "(" + x + " + " + y + "i)"; } } 

Submitted July 12, 2017 at 09:20PM by QxUAS_op3-3
via reddit http://ift.tt/2t5FmG8

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s