1. 求java程序!!!大一的java課程設計題目,求高手送程序~~~求大家幫忙啊~~~
完整的Java程序:
public class Test32 {
public static void main(String[] args) {
Complex c1 = new Complex(2, -1);
Complex c2 = new Complex(3, 4);
int m = 3;
System.out.println(c1.toString() + "的絕對值:" + c1.abs());
System.out.println(c1.toString() + "自增後:" + c1.addBySelf());
System.out.println(c1.toString() + "自減後:" + c1.subtractBySelf());
System.out.println("(" + c1.toString() + ") + (" + c2.toString() + ") = " + c1.add(c2));
System.out.println("(" + c1.toString() + ") - (" + c2.toString() + ") = " + c1.subtract(c2));
System.out.println("(" + c1.toString() + ") * (" + c2.toString() + ") = " + c1.multiply(c2));
System.out.println("(" + c1.toString() + ") / (" + c2.toString() + ") = " + c1.divide(c2));
System.out.println(c1.toString() + "的" + m + "次方 = " + c1.power(m));
}
}
//復數類:初始化復數、求其絕對值、復數的加、減、乘、除、乘方、自加、自減
class Complex{
protected double real; //實部
protected double image; //虛部
public Complex(){
real = image = 0;
}
public Complex(double real, double image){
this.real = real;
this.image = image;
}
//復數的絕對值
public Complex abs(){
return new Complex(Math.abs(this.real), Math.abs(this.image));
}
//復數相加
public Complex add(Complex c){
return new Complex(this.real + c.real, this.image + c.image);
}
//復數相減
public Complex subtract(Complex c){
return new Complex(this.real - c.real, this.image - c.image);
}
//復數相乘
public Complex multiply(Complex c){
return new Complex(this.real * c.real - this.image * c.image,
this.real * c.image + this.image * c.real);
}
//復數相除
public Complex divide(Complex c){
return new Complex((this.real * c.real + this.image * c.image) / (c.real * c.real + c.image * c.image),
(this.image * c.real - this.real * c.image) / (c.real * c.real + c.image * c.image));
}
//復數乘方
public Complex power(int m){
if(m < 0)
return new Complex();
if(m == 0)
return new Complex(1, 0);
Complex c = this;
for(int i=1; i<m; i++){
c = c.multiply(this);
}
return c;
}
//復數自增
public Complex addBySelf(){
return new Complex(++this.real, ++this.image);
}
//復數自減
public Complex subtractBySelf(){
return new Complex(--this.real, --this.image);
}
public String toString(){
if(this.real == 0)
if(this.image == 0)
return "0";
else
return this.image + "i";
else
if(this.image == 0)
return this.real + "";
else if(this.image > 0)
return this.real + "+" + this.image + "i";
else
return this.real + "" + this.image + "i";
}
}
運行測試:
2.0-1.0i的絕對值:2.0+1.0i
2.0-1.0i自增後:3.0
3.0自減後:2.0-1.0i
(2.0-1.0i) + (3.0+4.0i) = 5.0+3.0i
(2.0-1.0i) - (3.0+4.0i) = -1.0-5.0i
(2.0-1.0i) * (3.0+4.0i) = 10.0+5.0i
(2.0-1.0i) / (3.0+4.0i) = 0.08-0.44i
2.0-1.0i的3次方 = 2.0-11.0i
2. 計算機軟體技術都需要學習什麼課程呢
計算機軟體技術專業主要學習以下課程:
編程語言:如C、C++、Java、Python等,以及相關的開發工具和技術。
數據結構和演算法:學習基本的數據結構、演算法設計和分析,以及常用的數據結構和演算法。
計算機網路:學習網路協議、網路互連技術、網路安全和網路應用等。
軟體工程:學習軟體開發的過程、方法和工具,包括需求分析、設計模式、軟體測試和維護等。
操作系統:學習操作系統的基本原理、進程管理、內存管理、文件系統和設備驅動程序等。
面向對象編程:學習面向對象的基本概念和編程技術,包括類、對象、繼承和多態等。
軟體測試技術:學習軟體測試的基本原理和方法,以及測試工具的使用。
系統分析與設計:學習系統分析和設計的基本方法,包括系統規劃、系統分析、系統設計等。
實踐課程:包括課程設計、實驗和項目開發等,以培養學生的實踐能力和創新精神。
此外,計算機軟體技術專業還可能涉及人工智慧、雲計算、大數據等領域的相關課程。
請注意,以上只是列舉了一些常見的計算機軟體技術專業課程,具體課程設置和教學內容會因學校和專業而有所不同。