ComplexNumbs

# ComplexNumbs - public int getRealNum return Re public int...

This preview shows pages 1–2. Sign up to view the full content.

package myPeach; /** */ public class ComplexNumbers { /** A and B are the real parts while Ci and Di are the imaginary ones. */ private int Re; private int Im; /* *================================= *Constructors *================================= */ public ComplexNumbers(ComplexNumbers po) { this(po.getRealNum(), po.getImagNum()); } public ComplexNumbers(int real) { this (real,0); } public ComplexNumbers(int ima, double b){ this (0,ima); } public ComplexNumbers(int ima, int real) { setRealNum(real); setImagNum(ima); } /*============================ *Methods *============================ */ //set and get methods

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public int getRealNum(){ return Re; } public int getImagNum(){ return Im; } public void setRealNum(int REAL) { Re = REAL; } public void setImagNum(int IMAG){ Im = IMAG; } //Add method public ComplexNumbers add(ComplexNumbers po) { int a, b, c, d; ComplexNumbers sum; a = this.getRealNum(); b = this.getImagNum(); c = po.getRealNum(); d = po.getImagNum(); sum = new ComplexNumbers(a+c, b+d); return sum; } public ComplexNumbers add(int real) { ComplexNumbers po = new ComplexNumbers(real, 0); Fraction sum = add(frac); return sum; } //Subtract Method }...
View Full Document

## This note was uploaded on 05/01/2008 for the course ECE 172 taught by Professor Olabe during the Spring '08 term at Christian Brothers.

### Page1 / 2

ComplexNumbs - public int getRealNum return Re public int...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online