• Welcome to ZD Forums! You must create an account and log in to see and participate in the Shoutbox chat on this main index page.
Locke
Reaction score
126

Profile posts Latest activity Postings Awarded medals About Trophies

  • T
    Hey, you seem to enjoy the Haunted Cartridge ARG. If you wanna talk about it sometime, I'm an avid fan!
    I like the series, but the ending of EG kinda ate my mind until I realized there were a couple of time skips involved. Orson did it well, I wish more good books like that were around!
    Hey Locke, could I ask if you got your username from the book "Ender's Game"?
    import java.util.Random;
    public class Complex
    {
    //fields (aka instance variables)
    private int real;
    private int imaginary;
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //CONSTRUCTORS
    //CONSTRUCTOR 1 - constructs a complex number with real part a and imaginary part b
    public Complex(int a, int b)
    {
    real = a;
    imaginary = b;
    }
    //CONSTRUCTOR 2 - constructs a complex number with only the real part, imaginary part is 0
    public Complex(int a)
    {
    real = a;
    imaginary = 0;
    }
    //CONSTRUCTOR 3 - contructs a random complex number
    public Complex()
    {
    Random link = new Random();
    real = link.nextInt(100);
    imaginary = link.nextInt(100);
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //METHODS
    //METHOD 1 - create a string of the complex number so it can print
    public String toString()
    {
    return real + "+" + imaginary + "i";
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //METHOD 2 - add two complex numbers
    public Complex plus(Complex other)
    {
    int left = this.real + other.real;
    int right = this.imaginary + other.imaginary;
    Complex result = new Complex(left, right);
    return result;
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //METHOD 3 - subtract two complex numbers
    public Complex minus(Complex other)
    {
    int left = this.real - other.real;
    int right = this.imaginary - other.imaginary;
    Complex result = new Complex(left, right);
    return result;
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //METHOD 4 - multiply two cmoplex numbers
    public Complex times(Complex other)
    {
    int left = this.real * other.real + -this.imaginary * other.imaginary;
    int right = this.real * other.imaginary + this.imaginary * other.real;
    Complex result = new Complex(left, right);
    return result;
    }
    }

    Just so you might wanted to know, the warning reads: Warning: The local variable sum1 is never read
    All methods are made correctly in a different page, and this Test program is in the same folder and all. But this won't compile for some reason.

    public class Test
    {
    public static void main(String[] args)
    {
    //entering complex numbers
    Complex c1 = new Complex();
    Complex c2 = new Complex(2,3);
    Complex c3 = new Complex(-3,5);
    Complex c4 = new Complex(5);
    Complex c5 = new Complex(1,-2);
    //doing the equations
    Complex sum1 = c2.plus(c3); THIS DOESN'T WORK
    Complex difference1 = c2.minus(c5); THIS DOESN'T WORK
    Complex sum2 = c4.plus(c5); THIS DOESN'T WORK
    Complex product1 = c1.times(c2);
    Complex product2 = c2.times(c3);
    //printing the equations and results
    System.out.println(c2 + "+" c3 "=" sum1);
    System.out.println(c2 + "-" c5 "=" difference1);
    System.out.println(c4 + "+" c5 "=" sum2);
    System.out.println("(" + c1 + ")" + "(" + c2 + ")" + "=" + product1);
    System.out.println("(" + c2 + ")" + "(" + c3 + ")" + "=" + product2);
    }
    }
    Didn't Miyamato say at an E3 conference or other gamers meeting that SwS was the 1st game in the timeline or am I just imaging that?
    I sent you the FR in case I wanted to ask/ need confirmation about Timeline stuff.

    Like your play list especially He Reigns, Shine(My Fav song by Newsboys), and Million Pieces.
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
Top Bottom