Giter VIP home page Giter VIP logo

company's Introduction

Company

Clone this repo: [email protected]:turingschool-examples/company.git

Complete the activity below:

Iteration 1 (Tests Provided)

Use the tests provided to create an Employee class that follows this interaction pattern:

employee = Employee.new({name: "Alice Smith", age: 20, salary: "50000"})
# => <#Employee:32847432>
employee.name
# => "Alice Smith"
employee.age
# => 20
employee.salary
# => 50000

Iteration 2

Use TDD to create a Department class that responds to the following interaction pattern:

employee_1 = Employee.new({name: "Alice Smith", age: 20, salary: "50000"})
# => <#Employee:32847432>
employee_2 = Employee.new({name: "Bobbi Jaeger", age: 30, salary: "100000"})
# => <#Employee:65745667>
department = Department.new("Accounting")
# => <#Department:3457689435>
department.name
# => "Accounting"
department.employee_count
# => 0
department.add_employee(employee_1)
# => 1
department.employee_count
# => 1
department.add_employee(employee_2)
# => 2
department.employee_count
# => 2
department.employees
# => [<#Employee:32847432>, <#Employee:65745667>]
department.average_salary
# => 75000

Iteration 3

Use TDD to create a Company class that responds to the following interaction pattern:

employee_1 = Employee.new({name: "Alice Smith", age: 20, salary: "50000"})
# => <#Employee:32847432>
employee_2 = Employee.new({name: "Bobbi Jaeger", age: 30, salary: "100000"})
# => <#Employee:65745667>
employee_3 = Employee.new({name: "Stephanie Jones", age: 30, salary: "150000"})
# => <#Employee:32847432>
employee_4 = Employee.new({name: "Janssen Tanaka", age: 50, salary: "200000"})
# => <#Employee:65745667>
department_1 = Department.new("Accounting")
# => <#Department:3457689435>
department_2 = Department.new("Security")
# => <#Department:8457875458>
company = Company.new("Ares Macrotechnology")
department_1.add_employee(employee_1)
# => 1
department_1.add_employee(employee_2)
# => 2
department_2.add_employee(employee_3)
# => 1
department_2.add_employee(employee_4)
# => 2
company.add_department(department_1)
# => <#Department:3457689435>
company.add_department(department_2)
# => <#Department:8457875458>
company.payroll
# => 500000
company.average_age
# => 32.5

Iteration 4

Use TDD to update your Company class so that is responds to the following interaction pattern:

employee_1 = Employee.new({name: "Alice Smith", age: 20, salary: "50000"})
# => <#Employee:32847432>
employee_2 = Employee.new({name: "Bobbi Jaeger", age: 30, salary: "100000"})
# => <#Employee:65745667>
employee_3 = Employee.new({name: "Stephanie Jones", age: 30, salary: "150000"})
# => <#Employee:32847432>
employee_4 = Employee.new({name: "Janssen Tanaka", age: 50, salary: "200000"})
# => <#Employee:65745667>
department_1 = Department.new("Accounting")
# => <#Department:3457689435>
department_2 = Department.new("Security")
# => <#Department:8457875458>
company = Company.new("Ares Macrotechnology")
department_1.add_employee(employee_1)
# => 1
department_1.add_employee(employee_2)
# => 2
department_2.add_employee(employee_3)
# => 1
department_2.add_employee(employee_4)
# => 2
company.add_department(department_1)
# => <#Department:3457689435>
company.add_department(department_2)
# => <#Department:8457875458>
company.roster
# => {"Accounting" => ["Alice Smith", "Bobbi Jaeger"], "Security" => ["Stephanie Jones", "Janssen Tanaka"]}
company.department_payroll
# => {"Accounting" => 150000, "Security" => 350000}

company's People

Contributors

brianzanti avatar memcmahon avatar

Watchers

James Cloos 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.