文件名称:ComplexNumber
- 所属分类:
- JSP源码/Java
- 资源属性:
- [Java] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- luoshe******
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
(1)编写一个复数类ComplexNumber,其中包括实例变量real、image,方法如下: 1)构造方法 ComplexNumber(double a,double b) 2) ComplexNumber add(ComplexNumber x) //当前复数对象与另一复数对象进行复数的加法运算,返回一新的复数对象 3) ComplexNumber sub(ComplexNumber x) //当前复数对象与另一复数对象进行复数的减法运算,返回一新的复数对象 4)double getReal () //获取复数对象的实部 5)double getImage () //获取复数对象的虚部 6)void show( ) //按照实部+虚部i(如10+8i)的形式显示复数对象的值 7)String toString()//返回复数对象对应的串(如4+7i) -(1) the preparation of a complex class ComplexNumber, including instance variables real, image, as follows: 1) construction method ComplexNumber (double a, double b) the 2) ComplexNumber add (ComplexNumber x)// plural object with another plural object plural addition operations, and return a new complex object 3) ComplexNumber sub (ComplexNumber x)// plural object with another plural object subtraction of complex numbers, and returns a new complex object 4) a double getReal ()// access to complex objects the imaginary part of the real part 5) double getImage ()// Get the plural object) void show ()// display in accordance with the+ imaginary of the real part of the Department of i (such 10+8i) in the form of the value of the complex object) String toString ()// return complex object corresponding to the string (such as 4+7i)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ComplexNumber.java