Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
"Empleado constructor en la clase Empleado no se puede aplicar a tipos dados";

Parece que estoy obteniendo el constructor Empleado en la clase El empleado no se puede aplicar a tipos dados; error y no estoy seguro de cómo solucionarlo. Soy bastante nuevo en la codificación, así que cuanto más simple sea la explicación, mejor. método donde se produce el error específicamente el "nuevo empleado();" en la primera linea

 Collections.sort(employees, new Employee()); System.out.println("\nFirst and Last Names of Employees sorted based on first Name\n"); for (Employee employee : employees) { System.out.println("First Name: " + employee.getfirstName() + " Last Name: " + employee.getlastName() + " Salary: " + employee.getSalary()); } List<Employee> newHirees = readFile(hirefile); // Add new Hired employees employees.addAll(newHirees); Collections.sort(employees, new Employee()); System.out.println("\nFirst and Last Names of Employees sorted based on first Name after adding new hires\n"); for (Employee employee : employees) { System.out.println("First Name: " + employee.getFirstName() + " Last Name: " + employee.getLastName() + " Salary: " + employee.getSalaryPaid()); } List<Employee> firedEmployees = readFile(firefile); System.out.println("\nFirst and Last Names of Employees After removing fired employees\n"); for (Employee fired : firedEmployees) { String firstName=fired.getFirstName(); String lastname=fired.getLastName(); for (Employee employee : employees) { if (employee.getFirstName().trim().equals(firstName) && employee.getLastName().equals(lastname)) { employees.remove(employee); } } } for (Employee employee : employees) { System.out.println("First Name: " + employee.getFirstName() + " Last Name: " + employee.getLastName()); } } //Employee class public class Employee{ String firstName; String lastName; String gender; int tenure; String rate; double salary; public Employee( String firstName, String lastName,String gender,int tenure, String rate,double salary ) { this.firstName=firstName; this.lastName=lastName; this.gender=gender; this.tenure=tenure; this.rate=rate; this.salary=salary; } //get and set methods public void setfirstName(String nm) { this.firstName=nm;} public void setlastName(String nm) { this.lastName=nm;} String getfirstName() { return this.firstName;} String getlastName() { return this.lastName;} public void setGender(String nm) { this.gender=nm;} public void setRate(String nm) { this.rate=nm;} String getGender(){ return this.gender;} String getRate(){ return this.rate;} void setSalary(double pr){ this.salary=pr;} double getSalary(){ return this.salary;} void setTenure(int q){ this.tenure=q;} int getTenure(){ return this.tenure;} public String toString(){ String s=this.firstName+" "+this.lastName+" "+this.gender+" "+this.tenure+" "+ this.rate+" "+this.salary; return(s); } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

No tiene un constructor sin parámetros, por lo que new Employee() no funcionará.

¿Por qué estás tratando de pasar eso como un parámetro allí de todos modos?

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!