Advanced Programming Cs012 Assignment 2

Skunks, Ass 2. Unit code: Cs012 Time: Due April 3rd 2012, 9:30A.m 1. Write a complete java program that makes use of class called employee that will be used to capture employee id, name, salary and allowance and compute gross salary. Overload the plus operator such that if employee1 and employee2 were objects of the type employee, the employee1 and employee2 will be legal and would add the basic salary allowances and gross salary of the 2 employees. Also overloaded the equality operator such that it can be used in the main method to check if 2 employees have the same numeration based on the gross salary 2. Write a function called ‘divide’ that accepts two integers and computes and returns the first integer divided by the second e.g 5/2 gives 2.5. the program should generate an error if the second integer is zero. Skunks, I got a college guy who can't understand that I do networks and sys administration not programming. Programmers . Especially Q 1.

Wait if he cant do this simple task ..mwaambie is time to have a serious reflection ..this is elementary OOP i did this exact question in an exam (dont ask if i nailed it).. plus the lecturer needs to be more challenging ..am sure you can google this answer ... Else Ay devs am sure you are more than willing to flex your coding skills, so lets make this interesting ...how would you execute this? On Tue, Apr 3, 2012 at 8:09 AM, Gate Keeper <mohasq@gmail.com> wrote:
Skunks,
Ass 2. Unit code: Cs012 Time: Due April 3rd 2012, 9:30A.m
1. Write a complete java program that makes use of class called employee that will be used to capture employee id, name, salary and allowance and compute gross salary. Overload the plus operator such that if employee1 and employee2 were objects of the type employee, the employee1 and employee2 will be legal and would add the basic salary allowances and gross salary of the 2 employees. Also overloaded the equality operator such that it can be used in the main method to check if 2 employees have the same numeration based on the gross salary 2. Write a function called ‘divide’ that accepts two integers and computes and returns the first integer divided by the second e.g 5/2 gives 2.5. the program should generate an error if the second integer is zero.
Skunks, I got a college guy who can't understand that I do networks and sys administration not programming. Programmers . Especially Q 1.
_______________________________________________ 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
-- GG

*Geoffrey,* There are people who look for chose careers based on how much they pay. This guy is among them. Tried explaining to him that IT is passion. Secondly, the only thing near programming are automation scripts. Can't remember the OOP concepts.

i know gate keeper .. lets say i ended up being a jack of all trades ..but as a student its is nice to know some of these things ...i remember in class i had a big issue with my netwoking classes ..layers ,protocols , routing , ip address calculation .. up to now i think unless my organisation says we will increase you salary by 50% if you get a ccna am not interested in it but i do get the concepts thanks to my education ... i can tell you this much i have former collegues who are coding better than me and they were networking buffs ... On Tue, Apr 3, 2012 at 8:27 AM, Gate Keeper <mohasq@gmail.com> wrote:
*Geoffrey,*
There are people who look for chose careers based on how much they pay. This guy is among them. Tried explaining to him that IT is passion.
Secondly, the only thing near programming are automation scripts. Can't remember the OOP concepts.
_______________________________________________ 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
-- GG

Geoffrey, In my line of work I don't do any programming.We agree you have no reason to do CCNA stuff unless the mgt insists on it. the same applies to me. I have no reason to do programming stuff unless my line of work demands of it. So are you able to crack such simple code because for me i have to seek reference which I can't do due to time constraints.

Gate Keeper ill have to leave this to the coders , i also haven't coded in a while but when put to task i can write some decent scripts for automating ..but as i said lets see what the coders have ....am always interested in seeing different coding styles... peculiar habit i picked in college when "comparing" my code with other classmates ... On Tue, Apr 3, 2012 at 8:53 AM, Gate Keeper <mohasq@gmail.com> wrote:
Geoffrey,
In my line of work I don't do any programming.We agree you have no reason to do CCNA stuff unless the mgt insists on it. the same applies to me. I have no reason to do programming stuff unless my line of work demands of it.
So are you able to crack such simple code because for me i have to seek reference which I can't do due to time constraints.
_______________________________________________ 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
-- GG

Geofrey, Sure, I also read other peoples scripts. Some guys write very exceptionally cool scripts.Now where are the programmers.

Gate keeper do you know that there is a possibility , that the guy who gave out the assignment might be a skunker??? On Tue, Apr 3, 2012 at 9:13 AM, Gate Keeper <mohasq@gmail.com> wrote:
Geofrey,
Sure, I also read other peoples scripts. Some guys write very exceptionally cool scripts.Now where are the programmers.
_______________________________________________ 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

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

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

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

I know of operator overloading in C++, not java. This question is a trap! Questions that make sure you don't get 100% On Tue, Apr 3, 2012 at 11:09 AM, Richard Gathogo <muraguri2005@gmail.com>wrote:
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
-- www.golavish.com - The travel and leisure www.raccuddasys.com - code Development issues
participants (6)
-
Frankline Chitwa
-
Gate Keeper
-
geoffrey gitagia
-
Geoffrey Mimano
-
Joseph Maina
-
Richard Gathogo