jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "write a java program" Watch "write a java program" New topic

write a java program

shobhit pareek

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 :


Data members:


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é

Joined: Nov 24, 2005
Posts: 14688

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: 15082

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 8 API documentation
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
I agree. Here's the link: http://aspose.com/file-tools
subject: write a java program
jQuery in Action, 3rd edition