Click here to Skip to main content
16,005,389 members
Home / Discussions / Java
   

Java

 
GeneralRe: how using sprite in j2me Pin
h1428-Sep-11 14:42
h1428-Sep-11 14:42 
GeneralRe: how using sprite in j2me Pin
Firo Atrum Ventus28-Sep-11 15:26
Firo Atrum Ventus28-Sep-11 15:26 
Questionspeech recognition Pin
gif202027-Sep-11 9:29
gif202027-Sep-11 9:29 
AnswerRe: speech recognition Pin
Richard MacCutchan27-Sep-11 10:02
mveRichard MacCutchan27-Sep-11 10:02 
GeneralRe: speech recognition Pin
gif202028-Sep-11 12:11
gif202028-Sep-11 12:11 
GeneralRe: speech recognition Pin
Richard MacCutchan28-Sep-11 12:22
mveRichard MacCutchan28-Sep-11 12:22 
QuestionPolynomial class - need some assistance with it Pin
mastdesi22-Sep-11 16:17
mastdesi22-Sep-11 16:17 
AnswerRe: Polynomial class - need some assistance with it Pin
Nagy Vilmos22-Sep-11 23:59
professionalNagy Vilmos22-Sep-11 23:59 
mastdesi wrote:
Java
poly[6] = new Polynomial(poly[1]); // has to be multiplied by 3

Possible better solution would be to add another method to Polynomial:

Java
public Polynomial multiply(int multiple) {
    return new Polynomial(this.getCoeff(0) * multiple,
            this.getCoeff(1) * multiple,
            this.getCoeff(2) * multiple,
            this.getCoeff(3) * multiple,
            this.getCoeff(4) * multiple,
            this.getCoeff(5) * multiple);
}


then you can use:

Java
poly[6] = poly[1].multiply(3); // has to be multiplied by 3


Also the print out at the end can be greatly simplified:
Java
// print out the results for the eight polynomials
for (int p = 0;
        p < 8;
        p++) {
    System.out.println("Polynomial " + p + " : " + poly[p] +
            " has " + poly[p].numberOfTerms() +
            " terms and evaluates to " + poly[p].evaluate(x) +
            " for x = " + x);



Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

GeneralRe: Polynomial class - need some assistance with it Pin
mastdesi23-Sep-11 5:50
mastdesi23-Sep-11 5:50 
QuestionHow to calculating Business Hours in java Pin
Member 423170021-Sep-11 15:54
Member 423170021-Sep-11 15:54 
AnswerRe: How to calculating Business Hours in java Pin
TorstenH.21-Sep-11 19:22
TorstenH.21-Sep-11 19:22 
AnswerRe: How to calculating Business Hours in java Pin
Richard MacCutchan21-Sep-11 21:47
mveRichard MacCutchan21-Sep-11 21:47 
AnswerRe: How to calculating Business Hours in java Pin
Nagy Vilmos21-Sep-11 21:49
professionalNagy Vilmos21-Sep-11 21:49 
GeneralRe: How to calculating Business Hours in java Pin
Richard MacCutchan22-Sep-11 0:10
mveRichard MacCutchan22-Sep-11 0:10 
GeneralRe: How to calculating Business Hours in java Pin
Nagy Vilmos22-Sep-11 0:37
professionalNagy Vilmos22-Sep-11 0:37 
AnswerRe: How to calculating Business Hours in java Pin
jschell22-Sep-11 8:41
jschell22-Sep-11 8:41 
GeneralRe: How to calculating Business Hours in java Pin
Nagy Vilmos22-Sep-11 22:57
professionalNagy Vilmos22-Sep-11 22:57 
GeneralRe: How to calculating Business Hours in java Pin
jschell23-Sep-11 12:19
jschell23-Sep-11 12:19 
GeneralRe: How to calculating Business Hours in java Pin
TorstenH.24-Sep-11 7:53
TorstenH.24-Sep-11 7:53 
GeneralJavascript in livecycle Pin
Incognito121-Sep-11 4:20
Incognito121-Sep-11 4:20 
GeneralRe: Javascript in livecycle Pin
Nagy Vilmos21-Sep-11 4:59
professionalNagy Vilmos21-Sep-11 4:59 
QuestionPlease check my program if it is correct Pin
mastdesi20-Sep-11 16:47
mastdesi20-Sep-11 16:47 
AnswerRe: Please check my program if it is correct Pin
Richard MacCutchan20-Sep-11 21:53
mveRichard MacCutchan20-Sep-11 21:53 
AnswerRe: Please check my program if it is correct Pin
Nagy Vilmos20-Sep-11 23:30
professionalNagy Vilmos20-Sep-11 23:30 
GeneralRe: Please check my program if it is correct Pin
David Skelly21-Sep-11 3:44
David Skelly21-Sep-11 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.