JS Import/Export workaround project issue

Hello, I’m trying to do this project: https://www.codecademy.com/courses/introduction-to-javascript/projects/workaround

However, I followed the steps from the video up to step 9, and I still get errors, instead of the expected outputs. Can someone point what I’m doing wrong? I don’t get it from the error terminal where or what the issue seems to be.

My code:

employee.js

//let salary = 100000;

let Employee = {
  salary: 100000
};


let payGrades = {
  entryLevel: { taxMultiplier: .05, benefits: ['health'], minSalary: 10000, maxSalary: 49999 },
  midLevel: { taxMultiplier: .1, benefits: ['health', 'housing'], minSalary: 50000, maxSalary: 99999 },
  seniorLevel: { taxMultiplier: .2, benefits: ['health', 'housing', 'wellness', 'gym'], minSalary: 100000, maxSalary: 200000 }
};

Employee.getCadre = function() {
  if (Employee.salary >= payGrades.entryLevel.minSalary && Employee.salary <= payGrades.entryLevel.maxSalary) {
    return 'entryLevel';
  } else if (Employee.salary >= payGrades.midLevel.minSalary && Employee.salary <= payGrades.midLevel.maxSalary) {
    return 'midLevel';
  } else return 'seniorLevel';
}

Employee.calculateTax = function() {
  return payGrades[Employee.getCadre()].taxMultiplier * Employee.salary;
}

Employee.getBenefits = function() {
  return payGrades[Employee.getCadre()].benefits.join(', ');
}

Employee.calculateBonus = function() {
  return .02 * Employee.salary;
}

Employee.reimbursementEligibility = function() {
  let reimbursementCosts = { health: 5000, housing: 8000, wellness: 6000, gym: 12000 };
  let totalBenefitsValue = 0; 
  let employeeBenefits = payGrades[Employee.getCadre()].benefits;
  for (let i = 0; i < employeeBenefits.length; i++) {
    totalBenefitsValue += reimbursementCosts[employeeBenefits[i]];
  }
  return totalBenefitsValue;
}

//console.log(Employee.salary);

export default Employee;

workAround.js:

import Employee from './employee';

function getEmployeeInformation(inputSalary) {
  Employee.salary = inputSalary;
  console.log('Cadre: ' + Employee.getCadre());
  console.log('Tax: ' + Employee.calculateTax());
  console.log('Benefits: ' + Employee.getBenefits());
  console.log('Bonus: ' + Employee.calculateBonus());
  console.log('Reimbursement Eligibility: ' + Employee.reimbursementEligibility() + '\n');


getEmployeeInformation(10000);
getEmployeeInformation(50000);
getEmployeeInformation(100000);
1 Like

Hello,

body of the function getEmployeeInformation defined in workAround.js does not end. Count parentheses :slight_smile: You need to add } before the function calls.

1 Like