package com.test;
public class ComplexNum {
x05// Z = a + bi
x05private int Rez;x05// 实部
x05private int Imz;x05// 虚部
x05
x05
x05public int getRez() {
x05x05return Rez;
x05}
x05public void setRez(int rez) {
x05x05Rez = rez;
x05}
x05public int getImz() {
x05x05return Imz;
x05}
x05public void setImz(int imz) {
x05x05Imz = imz;
x05}
x05public ComplexNum(){}
x05
x05// 构造函数
x05public ComplexNum(int rez,int imz) {
x05x05super();
x05x05Rez = rez;
x05x05Imz = imz;
x05}
x05
x05// 加
x05public static void plus(ComplexNum a,ComplexNum b){
x05x05ComplexNum temp = new ComplexNum();
x05x05temp.setRez(a.getRez()+b.getRez());
x05x05temp.setImz(a.getImz()+b.getImz());
x05x05display(temp);
x05}
x05
x05// 减
x05public static void minus(ComplexNum a,ComplexNum b){
x05x05ComplexNum temp = new ComplexNum();
x05x05temp.setRez(a.getRez()-b.getRez());
x05x05temp.setImz(a.getImz()-b.getImz());
x05x05display(temp);
x05}
x05
x05// 显示
x05public static void display(ComplexNum a){
x05x05StringBuffer sb = new StringBuffer();
x05x05sb.append(a.getRez());
x05x05if(a.getImz()>0){
x05x05x05sb.append("+"+a.getImz()+"i");
x05x05}else if(a.getImz()