Skip to content

Object-Oriented Programming Mini-Project with Class Inheritance on App Academy Open

Notifications You must be signed in to change notification settings

Combatd/manager_mini_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

manager_mini_project

Object-Oriented Programming Mini-Project with Class Inheritance on App Academy Open

Learning Goals

  • Understand how a subclass inherits from a superclass
  • Know how to override a parent class's method
  • Know when and how to use super

Employee and Manager

  • Class Employee has attributes that return the employee's name, title, salary, and boss.

  • Class Manager extends Employee. Manager has an attribute that holds an array of all employees assigned to the manager. Managers might report to higher level managers.

  • Method bonus(multiplier) on Employee class. Non-manager employees should get a bonus like this

bonus = (employee salary) * multiplier
  • Managers should get a bonus based on the total salary of all of their subordinates, as well as the manager's subordinates' subordinates, and the subordinates' subordinates' subordinates, etc.

bonus = (total salary of all sub-employees) * multiplier

Testing

If we have a company structured like this:

Name	Salary	Title	Boss
Ned	\$1,000,000	Founder	nil
Darren	\$78,000	TA Manager	Ned
Shawna	\$12,000	TA	Darren
David	\$10,000	TA	Darren

then we should have bonuses like this:

ned.bonus(5) # => 500_000
darren.bonus(4) # => 88_000
david.bonus(3) # => 30_000

About

Object-Oriented Programming Mini-Project with Class Inheritance on App Academy Open

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages