Click here to Skip to main content
15,075,492 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Create a Java application which can be used by employers/employees. 
Employee’s data should be saved in a file named "employee.txt". Each employee has the following data: • personId (String) 
• name (String) 
• surname (String) 
• date of birth (Date) 
• password (String) – The password must start with a number and have more than 6 characters 
• yearsOfExperience (integer) 
• isEmpolyed (boolean) 
• employmentRequestId (null if the employee has not made any employment request) 
• companyId (null if the employee is not employed)
 Employer’s data should be saved in a file named "employer.txt". Each employer has the following data: 
• personId (String) 
• name (String) 
• surname (String) 
• date of birth (Date) 
• password (String) – The password must contain more than 8 characters 
• companyId (String)
 • companyName (String) 
• numberOfEmplyees (integer) 
• industry (String) 
Job vacancies should be saved in a file named "vacancies.txt". 
Each job vacancy has the following data: 
• vacancyId (String) 
• companyId (String) 
• jobDescription (String) 
• isVacancyOpen (boolean) 
* When the application is started, this question should be displayed: Are you an employee / employer / admin? If the user’s answer is "admin", then the admin password is required -> if the password is correct, then the application menu (for admins) is displayed:
 1. Add a new employee in file "emplyee.txt" 2. Add a new employer in file "emplyer.txt" 
If the given password is not correct no menu is displayed and the application is terminated. (The admin password should be ‘admin’!) If the user’s answer is "employer", then the employer password is required -> if the password is correct, then the application menu (for employers) is displayed: 
1. Add a new vacancy in file "vacancy.txt" (the companyId should be the same as the logged in employer companyId) 
2. View the list of all employees who are not employed.
3. View the list of all employees who are employed in his/her company 
4. View the list of all employees who have applied for a vacancy from his/her company 
5. Accept the application of an employee (the vacancy’s isVacancyOpen should be set as false, employee’s isEmployed should be set to true, employmentRequestId should be set to null and companyId should be set to the same value as the value of companyId in the accepted vacancy) 
6. Terminate the program If the given password is not correct no menu is displayed and the application is terminated. If the user’s answer is "employee", then the employee password is required -> if the password is correct, then the application menu (for employees) is displayed:
 1. View the list of all job vacancies (only vacancies which are open) 
2. Apply for a job vacancy (employmentRequestId should be set as the vacancyId) If the given password is not correct no menu is displayed and the application is terminated
In the admin menu add options: 
3. Display the company name which has added more job vacancies! 
4. Enter the name of a company and display the names of all employees of this company!


What I have tried:

import java.util.Date;
import java.util.Scanner;

public class Employee {
	
	private String personId;
	private String name;
	private String surname;
	private Date dateOfBirth;
	private String password;
	private int yearsOfExperience;
	private boolean isEmployed;
	private String employmentRequestId;
	private String companyId; 
	
	public static void main(String[] args) {
		System.out.println("Are you employee/employer/admin? ");
	}
	public Employee (String personId, String name, String surname, 
			Date dateOfBirth, String password, int yearsOfExperience) {
		this.personId = personId;
		this.name = name;
		this.surname = surname;
		this.dateOfBirth = dateOfBirth;
		this.password = password;
		this.yearsOfExperience = yearsOfExperience;
	}
	public String getpersonId() {
		return personId;
	    }
	public String getName() {
		return name;
	    }
	public String getsurname() {
		return surname;
	    }
	public Date getdateOfBirth() {
Posted
Updated 14-May-21 5:52am
Comments
Dave Kreskowiak 14-May-21 10:52am
   
If you've got a specific question or problem, please update the question with the details.

You're not going to send your code to anyone. YOU are the only person who's going to write this code. Asking other people to do your work for you is insulting.

1 solution

Because we have no idea how far you have got - and what you have shown us so far is "nowhere at all" - we can;t help you fix specific problems - and while we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]

If you haven't started at all, then I'd start by looking closely at the data you have to store, and working out how the heck I was going to store it, because you need to have some way to recognise one field from the next (the "name" from the "surname" for example) and also each row of data from the next row.
There are a lot of different ways to do that, and I have no idea what you have been taught, so I can't say "do this" and leave you to it. I know how I'd do it, but that's probably not an option for you unless you understand JSON data and how to handle it.
I would string suggest that you use a very similar layout for each of the three files you need to create as that will make your work a lot easier!

When you have data storage worked out, you can start working on storage in your app, and coding to move between the file and your app - but it's pointless to start the other way around as the storage method may well dictate the internal layout to a greater or lesser extent - and you can't test your code until you have data to work with!
   
Comments
[no name] 14-May-21 16:52pm
   
i have done the exact same thing for the other two requests I can't go forward with the code as I haven't yet learned how to do them. That's why I asked for your help I am not saying that you do my work. just tell me what to do at least if you can. thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900