Giter VIP home page Giter VIP logo

oo-flatironmifflin-sf-web-091619's Introduction

The Office

In this project, you will get the chance to practice object relationships in Ruby, with a particular emphasis on the has_many/belongs_to relationship. Make sure you read the entire README and map out your domain models before writing any code!

Introduction

Welcome to your first day at the Flatiron Mifflin Paper Company. As the Assistant to the Regional Manager, your job is to implement the new Office Management System for both the employees and their managers. Since Michael (your boss) has personally tasked you with this job, you can't disappoint.


Setup (Code)

Your goal is to build out all of the methods listed in the deliverables. Do your best to follow Ruby best practices. For example, use higher-level array methods such as map, select, and find when appropriate in place of each

We've provided you with a console that you can use to test your code. To enter a console session, run ruby run.rb from the command line. You'll be able to test out the methods that you write here. Take a look at that file to see how you can pre-define variables and create object instances, rather than manually doing it in every single console session.

There are no tests! You will need to test your code on your own!


Domain Modeling

First step to this problem is to consider your domain. At Flatiron Mifflin, an Employee can only work in one department and a Manager oversees only one department. There are often many Employees working for one Manager because if there are two Managers to "microgement" one employee, the employee might become "aggressive", "hostile" or "difficult."

Here are some questions to consider:

  • What are your models?
  • What does your domain look like?
  • What are the relationships between your models?

Deliverables

Manager

  • Manager#name
    • returns a String that is the manager's name
  • Manager#department
    • returns a String that is the department that the manager oversees
  • Manager#age
    • returns a Fixnum that is the age of the manager
  • Manager#employees
    • returns an Array of all the employees that the manager oversees
  • Manager.all
    • returns an Array of all the managers
  • Manager#hire_employee
    • takes a String argument and a Fixnum argument of an employee's name and the employee's salary, respectively, and adds that employee to the list of employees that the manager oversees
  • Manager.all_departments
    • returns an Array of all the department names that every manager oversees
  • Manager.average_age
    • returns a Float that is the average age of all the managers

Employee

  • Employee#name
    • returns a String that is the employee's name
  • Employee#salary
    • returns a Fixnum that is the employee's salary
  • Employee#manager_name
    • returns a String that is the name of their manager
  • Employee.all
    • returns an Array of all the employees
  • Employee.paid_over
    • takes a Fixnum argument and returns an Array of all the employees whose salaries are over that amount
  • Employee.find_by_department
    • takes a String argument that is the name of a department and returns the first employee whose manager is working in that department
  • Employee#tax_bracket
    • returns an Array of all the employees whose salaries are within $1000 (± 1000) of the employee who invoked the method

oo-flatironmifflin-sf-web-091619's People

Contributors

hyeokjungkim avatar notnotdrew avatar maxwellbenton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.