Click here to Skip to main content
15,916,600 members
Home / Discussions / Java
   

Java

 
AnswerRe: Green Field Java Pin
Nagy Vilmos7-Oct-11 2:57
professionalNagy Vilmos7-Oct-11 2:57 
AnswerRe: Green Field Java Pin
David Skelly7-Oct-11 3:13
David Skelly7-Oct-11 3:13 
GeneralRe: Green Field Java Pin
cjb1107-Oct-11 3:31
cjb1107-Oct-11 3:31 
GeneralRe: Green Field Java Pin
jschell7-Oct-11 8:49
jschell7-Oct-11 8:49 
GeneralRe: Green Field Java Pin
David Skelly9-Oct-11 22:13
David Skelly9-Oct-11 22:13 
AnswerRe: Green Field Java Pin
jschell7-Oct-11 8:59
jschell7-Oct-11 8:59 
Questionhelp: equals() method to compare the attributes Pin
mastdesi6-Oct-11 17:24
mastdesi6-Oct-11 17:24 
AnswerRe: help: equals() method to compare the attributes Pin
TorstenH.6-Oct-11 19:30
TorstenH.6-Oct-11 19:30 
equals() does compare the objects and returns true if so.

You've done it right in the class Vehicule. You just need to compare also the rest of the fields:
EDIT: I added super.equals(object) to get also the fields of the extended object compared.

Java
public boolean equals(Vehicule e) {
    boolean ans;
    if(true == super.equals(e) &&
       this.fuelT  == e.fuelT &&
       this.consum == e.consum &&
       this.price  == e.price ){
        return true;
    }
    return ans;
}


You should implement it in a similar way into the other classes.
Also are accessors and mutators missing as they are demanded. Would be nice if you use them in the equals() methods.
AND: Vehicle is written without U - but that's just a style thingy.
regards Torsten
I never finish anyth...

GeneralRe: help: equals() method to compare the attributes Pin
David Skelly6-Oct-11 22:17
David Skelly6-Oct-11 22:17 
GeneralRe: help: equals() method to compare the attributes Pin
TorstenH.7-Oct-11 0:18
TorstenH.7-Oct-11 0:18 
GeneralRe: help: equals() method to compare the attributes Pin
mastdesi7-Oct-11 4:09
mastdesi7-Oct-11 4:09 
GeneralRe: help: equals() method to compare the attributes Pin
Nagy Vilmos7-Oct-11 4:36
professionalNagy Vilmos7-Oct-11 4:36 
GeneralRe: help: equals() method to compare the attributes Pin
mastdesi7-Oct-11 5:20
mastdesi7-Oct-11 5:20 
GeneralRe: help: equals() method to compare the attributes Pin
Nagy Vilmos7-Oct-11 7:12
professionalNagy Vilmos7-Oct-11 7:12 
GeneralRe: help: equals() method to compare the attributes Pin
mastdesi7-Oct-11 8:52
mastdesi7-Oct-11 8:52 
AnswerRe: help: equals() method to compare the attributes Pin
Nagy Vilmos6-Oct-11 22:43
professionalNagy Vilmos6-Oct-11 22:43 
GeneralRe: help: equals() method to compare the attributes Pin
mastdesi7-Oct-11 5:17
mastdesi7-Oct-11 5:17 
GeneralRe: help: equals() method to compare the attributes Pin
Nagy Vilmos7-Oct-11 7:14
professionalNagy Vilmos7-Oct-11 7:14 
QuestionPlease help with java assignment Pin
mastdesi6-Oct-11 4:43
mastdesi6-Oct-11 4:43 
AnswerRe: Please help with java assignment Pin
Nagy Vilmos6-Oct-11 5:46
professionalNagy Vilmos6-Oct-11 5:46 
GeneralRe: Please help with java assignment Pin
mastdesi6-Oct-11 6:19
mastdesi6-Oct-11 6:19 
GeneralRe: Please help with java assignment Pin
TorstenH.6-Oct-11 19:44
TorstenH.6-Oct-11 19:44 
GeneralRe: Please help with java assignment Pin
Nagy Vilmos6-Oct-11 23:31
professionalNagy Vilmos6-Oct-11 23:31 
GeneralRe: Please help with java assignment Pin
mastdesi6-Oct-11 6:33
mastdesi6-Oct-11 6:33 
GeneralRe: Please help with java assignment Pin
Nagy Vilmos6-Oct-11 23:58
professionalNagy Vilmos6-Oct-11 23:58 

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.