herrDeng網內搜尋

自訂搜尋

Ads

2015年11月17日 星期二

ex5.練習以LinkedList操作多項式


47 則留言:

b10333102三于婷 提到...

import java.util.LinkedList; class Term { double coeff; int exp; public Term(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } } public class hw1 { public static void main(String[] args) { LinkedList f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for(int i=0;i

B10333064 提到...

import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList<ex2> f=new LinkedList<ex2>(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }

}

B1033070 徐承瑋 提到...

package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }

public class ex2 {

public static void main(String[] args) {

aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList<aaa> f = new LinkedList<aaa>(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

B10333107-曾詠浩 提到...

package p1;

import java.util.*;

class t{ double coeff; int exp; public t(double coeff,int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class text2 {

public static void main(String[] args) { t a=new t(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList<t> f=new LinkedList<t>(); f.addLast(a); t b=new t(-5,2); f.addLast(b); t c=new t(19,0); f.addLast(c); while(!f.isEmpty()){ t tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();}}

B10333108莊祐瑋 提到...

import java.util.LinkedList;

class Term{
double coeff;
int exp;
public Term(double coeff, int exp){
this.coeff = coeff;
this.exp = exp;
}
void print(){
if(coeff>0)
System.out.print("+"+coeff);
else
System.out.print(coeff);
System.out.print("x^"+exp);
}
}
public class ex1
{

public static void main(String[] args)
{
Term a=new Term(5,7);
a.print();
System.out.println();
LinkedList f=new LinkedList();
f.addLast(a);
Term b=new Term(666,5);
f.addLast(b);
while(!f.isEmpty()){
Term tmp=f.getFirst();
tmp.print();
f.removeFirst();

}
System.out.print();
}

}

B10333106劉郁芃 提到...

import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117 { public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101), new Term(-5,2),new Term(19,0)}; for(int i=0; i<ff.length; i++) f.addLast(ff[i]); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); } System.out.println(); }}

B10333066 周政霆 提到...

package p1;import java.util.LinkedList;class ABCD{ double coeff; int exp; public ABCD(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }

public class ex2 {

public static void main(String[] args) {

ABCD A = new ABCD (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList<ABCD> f = new LinkedList<ABCD>(); f.addLast(A); ABCD B = new ABCD(-5,2); f.addLast(B); ABCD C = new ABCD(19,0); f.addLast(C); while (!f.isEmpty()){ ABCD tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

B10333108莊祐瑋 提到...

import java.util.LinkedList;

class Term{ double coeff; int exp; public Term(double coeff, int exp){ this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1 {

public static void main(String[] args) { Term a=new Term(5,7); a.print(); System.out.println(); LinkedList<Term> f=new LinkedList<Term>(); f.addLast(a); Term b=new Term(666,5); f.addLast(b); while(!f.isEmpty()){ Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.print(); }

}

B10333075 曾敬堯 提到...

import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp){ this.coeff =coeff; this.exp = exp;}void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp);}}public class ex1 {

public static void main(String[] args) { Term a = new Term(-5, 7); a.print();System.out.println();LinkedList<Term> f=new LinkedList<Term>();f.addLast(a);Term b=new Term(666, 5);f.addLast(b);while(!f.isEmpty()){ Term tmp = f.getFirst(); tmp.print(); f.removeFirst();}System.out.println();} }

B10333087 蔡銘家 提到...

mport java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff,int exp){ this.coeff =coeff; this.exp = exp;}void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp);}}public class ex1 { public static void main(String[] args){ Term a = new Term(-5, 7); a.print();System.out.println();LinkedList<Term> f=new LinkedList<Term>();f.addLast(a);Term b=new Term(666,5);f.addLast(b);while(!f.isEmpty()){ Term tmp = f.getFirst(); tmp.print(); f.removeFirst();}System.out.println();}}

B10333072黃玟茜_資管二乙 提到...

package p1;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class test1 { public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for(int i=0;i<ff.length;i++) f.addLast(ff[i]); while(!f.isEmpty()) { f.getFirst().print(); f.removeFirst(); } System.out.println(); }

}

b10333094張之銜 提到...

package p1;

import java.util.LinkedList;

class ddd { double coeff; int exp; public ddd(double coeff, int exp){ this.coeff= coeff; this.exp = exp; } void print(){ System.out.print("+"+coeff); System.out.print("x^"+exp); }}public class hw2 {

public static void main(String[] args) { ddd a=new ddd (789,101); a.print(); System.out.println(); LinkedList<ddd> f=new LinkedList<ddd>(); f.addLast(a); ddd b=new ddd(666,5); f.addLast(b); while(!f.isEmpty()){ ddd tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

B10333086 陳晏堂 提到...

package www;import java.util.LinkedList;class Term{double coeff;int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print() { if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class w{ public static void main(String[] args) {LinkedList<Term> f=new LinkedList<Term>();Term[] ff={new Term(789,101),new Term(-5,2),new Term(19,0)};for(int i=0;i<ff.length; i++) f.addLast(ff[i]); while(!f.isEmpty()) { f.getFirst().print(); f.removeFirst(); } System.out.println(); }}

B10333083,周琬芸 提到...

import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff=coeff; this.exp=exp; } void print() { if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex6{ public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for (int i=0 ; i<ff.length;i++) { f.addLast(ff[i]); while(!f.isEmpty()) { f.getLast().print(); f.removeFirst(); } }System.out.println(); }

}

B10333061陳柏諺 提到...

package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {

public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList<Term> f=new LinkedList<Term>(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();

}

}

B10333082吳樹凱 提到...

package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {

public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList<Term> f=new LinkedList<Term>(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();

}

}

B10333057楊嘉昀 提到...

import java.util.LinkedList; class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } } public class ex1117 { public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101), new Term(-5,2),new Term(19,0)}; for(int i=0; i<ff.length; i++) f.addLast(ff[i]); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); } System.out.println(); } }

b10333079 葉禮魁 提到...

package 新增資料夾;

import java.util.LinkedList;

class i{ double coeff; int exp; public i(double coeff,int exp) { this.coeff= coeff; this.exp=exp; } void print() { System.out.print("+"+coeff); System.out.print("x^"+exp); }}public class p2 {

public static void main(String[] args) { i a=new i(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList<i> f=new LinkedList<i>(); f.addLast(a); i e=new i(-5,2); f.addLast(e); i b=new i(19,0); f.addLast(b); while(!f.isEmpty()){ i tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

b10333080王育文 提到...

import java.util.*;class x{ double coeff; int exp; public x(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class text2 {

public static void main(String[] args) { x f=new x(789,101); f.print(); System.out.println(); LinkedList<x> y=new LinkedList<x>(); y.addLast(f); x z=new x(-5,2); y.addLast(z); x a=new x(19,0); y.addLast(a); while(!y.isEmpty()){ x tmp=y.getFirst(); tmp.print(); y.removeFirst(); } System.out.println(); }

}

B103331000李禹範 提到...

package p1;import java.util.LinkedList;class ABCD{ double coeff; int exp; public ABCD(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }

public class ex2 {

public static void main(String[] args) {

ABCD A = new ABCD (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList<ABCD> f = new LinkedList<ABCD>(); f.addLast(A); ABCD B = new ABCD(-5,2); f.addLast(B); ABCD C = new ABCD(19,0); f.addLast(C); while (!f.isEmpty()){ ABCD tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

B10333097胡聖恩 提到...

import java.util.LinkedList;class Here { double coeff; int exp; public Here(double coeff,int exp){ this.coeff=coeff; this.exp=exp; } void print(){ System.out.print("+"+coeff); System.out.print("x"+exp); }}public class test2 { public static void main(String[] args) { Here a=new Here(789,101); a.print(); System.out.println(); { LinkedList<Here> f=new LinkedList<Here>(); f.addLast(a); Here b=new Here(-5,2); f.addLast(b); Here c=new Here(19,0); f.addLast(c); while(!f.isEmpty()){ Here tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); } }}

B10333055翁恩義 提到...

package hello;import java.util.*;

class T{ double coeff; int exp; public T(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}

public class hw2 {

public static void main(String[] args) { T a=new T(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList<T> f=new LinkedList<T>(); f.addLast(a); T b=new T(-5,2); f.addLast(b); T c=new T(19,0); f.addLast(c); while(!f.isEmpty()) { T tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

張鈞閔 提到...

package p1;
import java.util.LinkedList;
class ABCD{
double coeff;
int exp;
public ABCD(double coeff, int exp){
this.coeff=coeff;
this.exp=exp;
}
void print(){
if (coeff>0)
System.out.print("+"+coeff);
else
System.out.print(coeff);
System.out.print("x^"+exp);
}

}

public class ex2 {

public static void main(String[] args) {

ABCD A = new ABCD (789,101);
System.out.print("f(x)=");
A.print();
System.out.println();
LinkedList f = new LinkedList();
f.addLast(A);

ABCD B = new ABCD(-5,2);
f.addLast(B);

ABCD C = new ABCD(19,0);
f.addLast(C);

while (!f.isEmpty()){
ABCD tmp=f.getFirst();
tmp.print();
f.removeFirst();
}
System.out.println();

}

}

b10333063羅胤銓 提到...

package asdf;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { System.out.print("+"+coeff); System.out.print("x^"+exp); }}

public class zxcv {

public static void main(String[] args) { Term a=new Term(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList<Term> f=new LinkedList<Term>(); f.addLast(a); Term e=new Term(-5,2); f.addLast(e); Term b=new Term(-5,2); f.addLast(b); while(!f.isEmpty()){ Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }}

B10333081曹正諭 提到...

package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {

public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();

}

}

B10333062邱鐠生 提到...

package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {

public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();

}

}

B10333076葉至倫 提到...

package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {



public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();



}



}

B10333069 提到...

B10333069 李宜謙
import java.util.LinkedList;

class Term{
double coeff;
int exp;
public Term(double coeff, int exp){
this.coeff = coeff;
this.exp = exp;
}
void print(){
if(coeff>0)
System.out.print("+"+coeff);
else
System.out.print(coeff);
System.out.print("x^"+exp);
}
}
public class ex1
{

public static void main(String[] args)
{
Term a=new Term(5,7);
a.print();
System.out.println();
LinkedList f=new LinkedList();
f.addLast(a);
Term b=new Term(666,5);
f.addLast(b);
while(!f.isEmpty()){
Term tmp=f.getFirst();
tmp.print();
f.removeFirst();

}
System.out.print();
}

}

b10333088姜璧珊 提到...

package asdf;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { System.out.print("+"+coeff); System.out.print("x^"+exp); }}

public class zxcv {

public static void main(String[] args) { Term a=new Term(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term e=new Term(-5,2); f.addLast(e); Term b=new Term(-5,2); f.addLast(b); while(!f.isEmpty()){ Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }}

B10333073湯宇謙 提到...

package p1;

import java.util.*;

class t{ double coeff; int exp; public t(double coeff,int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class text2 {

public static void main(String[] args) { t a=new t(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); t b=new t(-5,2); f.addLast(b); t c=new t(19,0); f.addLast(c); while(!f.isEmpty()){ t tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();}}

B10236116 許誌文 提到...

package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {

public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();

}

}

B10333103王思洳 提到...

package asdf;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { System.out.print("+"+coeff); System.out.print("x^"+exp); }}



public class zxcv {



public static void main(String[] args) { Term a=new Term(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term e=new Term(-5,2); f.addLast(e); Term b=new Term(-5,2); f.addLast(b); while(!f.isEmpty()){ Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }}

B10333104 郭杰哲 提到...

package p1;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class test1 { public static void main(String[] args) { LinkedList f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for(int i=0;i<ff.length;i++) f.addLast(ff[i]); while(!f.isEmpty()) { f.getFirst().print(); f.removeFirst(); } System.out.println(); }

}

B10333065 林雨婷 提到...

mport java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117 { public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101), new Term(-5,2),new Term(19,0)}; for(int i=0; i<ff.length; i++) f.addLast(ff[i]); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); } System.out.println(); }}

B10333073湯宇謙 提到...

package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }

public class ex2 {

public static void main(String[] args) {

aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

B10333073湯宇謙 提到...

package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }

public class ex2 {

public static void main(String[] args) {

aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

B10333059 吳紹松 提到...

import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }

}

B10333060 方際盛 提到...

import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }

}

B10333098蔡紹威 提到...

import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }

}

B10333089游智翔 提到...

import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }

}

b10333092黃星維 提到...

package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }

public class ex2 {

public static void main(String[] args) {

aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

b10333093 徐子軒 提到...

package b10333093;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } } public class ex3 { public static void main(String[] args) { aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); } }

B10333101游承浩 提到...

import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }

}

B10333067 提到...

package p1;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class test1 { public static void main(String[] args) { LinkedList f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for(int i=0;i<ff.length;i++) f.addLast(ff[i]); while(!f.isEmpty()) { f.getFirst().print(); f.removeFirst(); } System.out.println(); }

}

B10333077潘家銘 提到...

mport java.util.*;class x{ double coeff; int exp; public x(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class text2 {



public static void main(String[] args) { x f=new x(789,101); f.print(); System.out.println(); LinkedList<x> y=new LinkedList<x>(); y.addLast(f); x z=new x(-5,2); y.addLast(z); x a=new x(19,0); y.addLast(a); while(!y.isEmpty()){ x tmp=y.getFirst(); tmp.print(); y.removeFirst(); } System.out.println(); }



}

林羿君 B10333109 提到...

import java.util.LinkedList;



class Term{

double coeff;

int exp;

public Term(double coeff, int exp){

this.coeff = coeff;

this.exp = exp;

}

void print(){

if(coeff>0)

System.out.print("+"+coeff);

else

System.out.print(coeff);

System.out.print("x^"+exp);

}

}

public class ex1

{



public static void main(String[] args)

{

Term a=new Term(5,7);

a.print();

System.out.println();

LinkedList f=new LinkedList();

f.addLast(a);

Term b=new Term(666,5);

f.addLast(b);

while(!f.isEmpty()){

Term tmp=f.getFirst();

tmp.print();

f.removeFirst();



}

System.out.print();

}



}

B10333071廖智加 提到...

package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }

public class ex2 {

public static void main(String[] args) {

aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }

}

Related Posts Plugin for WordPress, Blogger...

熱門文章