Hi everyone, I'm new here and new to
java programming and I have a rather large task to complete. I've only just started and got to around number 3) before I started thinking maybe I'm not writing the best code. I'll post the code and if anyone has any tips or spots any errors to please let me know so I can write better code. Also if anyone has any hints for the rest of the questions I would be grateful for any help you can provide as some of the stuff I have not come across before. Thank you
I have to use an array to write a program to store and manage a set of employees working in a small supermarket according to the following requirements:
1) There is a need to record details about each employee in the supermarket.
2) The application must allow for up to a maximum of 10 employees to be working in the supermarket.
3) For each employee, their Name, Address, Date of Birth and Gender must be stored.
Note: Create an array of type Employee where Employee is a class you create containing the name, address, DOB and gender as instance variables. You must check that the Gender has been entered correctly in whatever format you specify. You must also inform the user that if any of the fields are left blank for an employee, the employee's full details will not be saved beyond that current session.
4) The program needs to enable Employee's to be added to the supermarket's details and also to enable Employee's to be deleted from them.
Note: Deleting data from an array may leave a blank space in the array, so keep a count of the number of employees and search for the next free array cell when adding another employee.
5) It must be possible to report (via a print to the screen) on the supermaket. This report should include the name of the supermarket, the name of the supermarket owner, the total number of employees (excluding the owner) that are currently working there and the percentages of the workforce that are male and female.
6) At the end of a session, when the program is being terminated, the supermarket's details (from part 5) ) and the details of each employee must be written to disk. The two sets of details must be saved to two standard text files. The supermarket's details are to be saved to a file named" SupermarketDetails.txt" and the employee details are to be saved to a file named "EmployeeDetails.txt".
Note: Do NOT save blank records to disk, check that there is a valid "Employee" object in each array cell before writing its contents to disk. If any of the fields within an employee's details have been left blank (
string length of zero) then that employee is invalid and their details should not be written to disk.
7) When the program is started, it should read from these standard text files to re-populate the application with any previously stored data as a starting point.
Note: Each record requires a new instance of the Employee class to be created and linked to the next available free cell in your array.
8) The program user must also be able to search for an employee by name, causing the sought employee's details to be displayed if present.
Note: You can assume each employee's name will be unique
Employee Class
Supermarket Class
Records Class