Code Monkey home page Code Monkey logo

classy-coders-inc's Introduction

logo

Classy Coders Inc. ๐Ÿ‘ฉโ€๐Ÿ’ป

In a tech-driven world, the importance of skilled employees cannot be overstated. Enter "Classy Coders Inc", a software development company on a mission to revolutionize the way businesses operate. As a budding developer, you've just landed a job at this esteemed establishment and are tasked with creating a series of classes that represents employees at the company and will underlie the systems they are building.

They have provided you with the following class diagram that represents their current workforce.

Classy Coders Inc Class Diagram

Employees

Create a class Employees that has the following properties and methods:

  • name: A string representing the name of the employee.
  • position: A string representing the position of the employee.
  • salary: A private number representing the salary of the employee.
  • isHired: A private field that initializes with a value of true.
  • getSalary(): A method that returns the salary of the employee.
  • setSalary(amount): A method that updates the salary of the employee.
  • getStatus(): A method that returns the value of isHired.
  • setStatus(command): A method that updates isHired to:
    • true if command is "hire"
    • false if command is "fire"

Examples

const preston = new Employees("Preston", "Engineer", 100000);
preston.getSalary(); // 100000
preston.setSalary(105000);
preston.getSalary(); // 105000
preston.getStatus(); // true;
preston.setStatus("fire");
preston.getStatus(); // false;

Manager

Create a subclass Manager that extends Employees (don't forget to import Employees to the Manager.js file!) and has the following additional property and methods:

  • department: A string representing the department the manager is in charge of.
  • employeesManaged: A private property that holds an array of Employees the manager manages. Initializes as an empty array.
  • getEmployeesManaged(): A method that returns the employees a manager has.
  • setEmployeesManaged(employee): A method that updates the employeesManaged with a new employee

Examples

const jenna = new Manager("Jenna", "Head of Engineers", 120000, "Software Engineering", 10);
jenna.getEmployeesManaged(); // []
const preston = new Employees("Preston", "Engineer", 100000);
jenna.setEmployeesManaged(preston);
jenna.getEmployeesManaged(); // [ Employee ]

SoftwareEngineer

Create a class of SoftwareEngineer that extends Employee and has the following additional properties and methods:

  • programmingLanguages: A private property that holds an array of programming languages the software engineer knows.
  • getProgrammingLanguages(): A method to return the programmingLanguages that the engineer knows.
  • setProgrammingLanguage(language): A method to update the programmingLanguages with a new language to the array.

Examples

const programmer = new SoftwareEngineer("Becca", "Senior Software Engineer", 100000, ["JavaScript", "Java", "Python"]);
programmer.getProgrammingLanguages(); // ["JavaScript", "Java", "Python"]
programmer.setProgrammingLanguage("C#"); 
programmer.getProgrammingLanguages(); // ["JavaScript", "Java", "Python", "C#"]

SalesPerson

Create a class of SalesPerson that extends Employee and has the following additional properties and methods:

  • clients: A property that holds an array of clients the salesperson manages.
  • totalSales: A private field that contains the value of total sales the employee has performed. Initializes with a value of 0.
  • getSalesNumbers(): A method that returns the totalSales for the salesperson.
  • makeSale(amount): A method that updates the totalSale with the amount.

Examples

const malik = new SalesPerson("Malik", "Enterprise Sale Associate", 90000, ["Vine", "MySpace", "Shutterfly"])
malik.getSalesNumber(); // 0
malik.makeSale(10500);
malik.makeSale(20000);
malik.getSalesNumber(); // 30500

Updating Employee Class with Static Values

  • allEmployees: A private static private property that initializes as an empty array. Every time a new Employee is created they are added to the end of this array.
  • getEmployees: A static method that returns the array of allEmployees.
  • getTotalPayroll(): A static method that returns the total salaries of all employees that are stored in the allEmployees array.

Examples

const jenna = new Manager("Jenna", "Head of Engineers", 120000, "Software Engineering", 10);
const programmer = new SoftwareEngineer("Becca", "Senior Software Engineer", 100000, ["JavaScript", "Java", "Python"]);
const malik = new SalesPerson("Malik", "Enterprise Sale Associate", 90000, ["Vine", "MySpace", "Shutterfly"])

Employees.getEmployees(); // [ Manager { }, SoftwareEngineer { }, SalesPerson { }]
Employees.getTotalSalary(); // 310000

Stretch: Go Above and Beyond ๐Ÿš€

  1. Error Handling: Add error handling to the setSalary method of the Employee class. If the salary is less than 0, throw an error with the message "Salary cannot be negative".
  2. Search: Create a findClient(client) method for the SalesPerson class. It should return the client that matches the argument provided.
  3. Promotions: Add a promote method to the Employee class. This method should take in a new job title as an argument and update the employee's job title and salary accordingly. Implement this method in the Manager subclasses as well, as they may have additional promotion criteria.
  4. Performance Metrics: Add performance metrics to the Employee class. Each employee should have a set of metrics such as sales numbers for salespeople, project completion rate for software engineers, and employee retention rate for managers. Implement a method to calculate and return the performance score based on these metrics. Design a method that use this score to determine bonuses and/or promotions.

classy-coders-inc's People

Contributors

stevenjlance avatar nimonian avatar rubyheald 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.