This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes write a java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "write a java program" Watch "write a java program" New topic
Author

write a java program

shobhit pareek
Greenhorn

Joined: Aug 15, 2006
Posts: 4
: A company has many employees & each employee is led by only 1 person except for the CEO (who has no boss). The cost to the company of an employee is the sum of his salary plus the cost to the company of all the people led by him. Given is the following structure :

Employee

Data members:
Name
Salary
isBoss
nameOfBoss

Methods:
getSalary
getName

a) Define the class/structure
b) Write a function getCostToCompany() to calculate the cost to the company of an employee whose name is passed as a parameter to the function getCostToCompany


SCJP 1.4
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Hi shobhit,
please tell what you do not understand. We're not going to make the program for you.


[My Blog]
All roads lead to JavaRanch
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14117
    
  16

Please show some effort and do your own homework.

The point of homework is that you learn by doing it - not by letting others do it for you. So, start with it yourself, and if you get stuck, show us what you have done so far and why exactly you don't know how to continue, and then we'll be happy to give you hints and tips to help you.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Hey, and nobody said Welcome to the Ranch!

As the guys pointed out, the ranch works best if you take a shot at things, show us what you've made and tell us how you are stuck. Give it a try!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
 
subject: write a java program