In this assignment, you will write a very simple data maintenance Java program for a small computer retail store (like Staples). Some of the techniques used (arrays as data structures, insertion sort) will be review from cosc1047, while others (searching) will be the material you are now covering (or you have learned). This program will likely be physically longer than you have written so far, so remember do implement it in a modular fashion- do a proper program design even though you don?t have to hand your design in.;John?s computers that has just open to offer services. Your program will (thankfully) deal with only the management of employee salary of the business. Every employee of the company has an employee number, salary type, and monthly salary amount. You assume that employees might get fixed monthly salary and overtime pay. The system will store a record for each employee consisting of an employee number (an integer), salary type (a Char, R representing regular pay, O representing overtime pay), and the salary amount (a double). These are kept in three arrays-an array of employee numbers, an array of salary type, and an array of salary amount. A sample of what this might look like appears below;Employee ID Salary Type Array Amount Array Array;102241 R 2000;123045 R 3500.9;123045 O 1300.1;123456 R 34600.1;The entries in the array correspond to one another-for example, the first slot in all three arrays represent the fact that employee number 102241 has a salary type ?R? (regular pay) with $ 2000 amount. As is shown, the same employee number can appear several times, as employees can have more than one type of payment. These are called parallel arrays, because the slots in each correspond, and the really important thing about parallel arrays is that if you shuffle around anything in one array, you have to perform the same shuffles to the others. For example, say we delete one particular employee. If we remove the entry from the employee ID array, but not the others, nothing matches any more and the data is worthless. Similarly, if we sort by amount, every data movement in the Salary amount array must be duplicated in the others precisely, or once again the correspondence is lost. Since the array entries correspond to one another, we also need only keep track of the size (the number of entries used) once, since there will be the same number of entries in all three arrays.;Your system will not do terribly much (by payroll system standards!). When you start the program, it will look for a text file called employee.txt, open it, and load the three arrays with the data contained there. You can assume that employee.txt will contain one entry per line- the first employee number, then the type of payment on the next line, and the salary amount on the next line, then the next employee number, and so on. The data will not be in any particular order, but you can assume all data for each employee will be present (that is, there?ll be no un-matching salary amount, etc.), and that the data will be error-free. Your system will hold a maximum of 200 employees, but you do NOT know how many will be in the file (you?ll have to count them as you read and keep track of the sizes of arrays).;Once you have the data read in, you will prompt the user on the screen to enter commands (single characters). We will ignore the usual database update commands (creating, deleting employees, etc), and concentrate only on selecting and viewing data. The valid commands your system will support are S (Search for an employee), P (Print Total Salary), and Q (quit). You should error check these to ensure that other letters are not accepted (just print an error message in such cases and prompt for the command again). Your system will accept S and P commands until eventually the user enters a Quit command, causing the program to terminate. The P and S commands must operate as follows;When processing the Print Total Salary command, you will need to first ensure that the arrays representing the employees are sorted by employee number. Print Total Salary should thus begin by calling an Insertion Sort method that you must write. You will have to slightly alter the one you saw in class, because you are using parallel arrays here. Remember, you have to keep the correspondence between slots: this means that while you?re sorting the employee numbers, you will have to perform identical swaps in all three arrays. After the array has been sorted, Print Total Salary will print ONE entry for each employee showing the TOTAL of ALL the types of payment that employee has. Try to go through the arrays only ONCE to do this, which shouldn?t at all be a problem once the data?s sorted.;A Search command will allow the user to search for an employee by employee number. The routine to process a search command will prompt the user for a customer number. For example, searching for an employee of 12345 will cause ALL types of payments for employee number 12345 to be displayed, regardless of the types of payment.;Data returned by a search or Print Total Salary should be displayed in a table format, showing the fields from all three arrays (that is, the employee number, payment type, and amount for all ?found? employee entries). For a search, if no data is found, simply display a message indicating that. In general, data should be nicely formatted and columns should be labeled appropriately.;You do not need to have a GUI for your program. If you like, you can have one.
Paper#65573 | Written in 18-Jul-2015Price : $37