Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

write a java program

 
shobhit pareek
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
: 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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi shobhit,
please tell what you do not understand. We're not going to make the program for you.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic