I know of operator overloading in C++, not java. This question is a trap! Questions that make sure you don't get 100%
Hi Geoffrey,
Come to think of it. I have also never seen one. Actually I don't think sun java includes support for that. It is either the lecturer copied the assignment from c/c++ exercise or it is part of the assignment trick.
Regards Richard Gathogo.Love covers a multitude of sins.
On Tue, Apr 3, 2012 at 10:38 AM, Geoffrey Mimano <soyfactor@gmail.com> wrote:
I really want to see and example for operator overloading in java.. Someone please post some code for question 1?
Mimano G. Muthondu,
Software Developer
skype : gmimano
Mobile : +254 723 615 206--A lack of planning on your part does not constitute an emergency on my part (unknown)---
On 3 April 2012 10:28, Richard Gathogo <muraguri2005@gmail.com> wrote:Hi Gate Keeper,
For question 2 here is the method I would suggest:
public double divide(int integer1, int integer2){
if(integer2==0){
throw new Error("The second integer is 0");
}else{
return (double) ((double)integer1/(double)integer2);
}
}
Question 1 is also simple he will only need to create a class called Employee with the attributes of the fields captured and their methods. Also methods to do the calculations. Then create objects of class Employee in the main method where he will overload the operators. He can alert me in case he gets stuck.
Regards Richard Gathogo.Love covers a multitude of sins.
On Tue, Apr 3, 2012 at 9:37 AM, Gate Keeper <mohasq@gmail.com> wrote:He is not._______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke