Write a very simple data maintenance java program

Assignment Help JAVA Programming
Reference no: EM131299332

Assignment

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. Also remember to START THIS ASSIGNMENT SOON. DO NOT leave it until the last minute!

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.

Submission: Submit a printout of your program along with a copy of the output generated by running the program. Include comments in your code and ensure that all of the output is clearly explained.

Reference no: EM131299332

Questions Cloud

Insights regarding hypothetical commercial : As we have discussed, increases in GDP and aggregate income do not always mean the level of well-being and happiness increase as well for all citizens of a society. With this in mind, please explain your thoughts or insights regarding this hypothe..
The gain from the noise voltage of each resistor : In the circuit of Figure, prove that the gain from the noise voltage of each resistor to the VCO output frequency is equal to KVCO.
Is this experiment ethically objectionable : This experiment tempts subjects to cheat. The subjects are led to believe that they can cheat secretly when in fact they are observed. Is this experiment ethically objectionable? Explain your position.
Do you think rtas are stumbling or building blocks : Do you think RTAs are stumbling or building blocks? Briefly (in 1-2 paragraphs) and in your own words, explain your response by identifying two of the arguments covered in the readings.
Write a very simple data maintenance java program : In this assignment, you will write a very simple data maintenance Java program for a small computer retail store (like Staples).
Estimate the time necessary for the state to vanish : Assuming each output node has a leakage current of I1 and a total capacitance of C1, estimate the time necessary for the state to vanish.
Analyze the problem in the scenario : Define the problem in the scenario that you have chosen.- Analyze the problem in the scenario.- Generate options for solving the problem in the scenario.
Developing nations regarding the comparative-advantage : Discuss two (2) of the major reasons for the skepticism of many developing nations regarding the comparative-advantage principle and free trade. Discuss two (2) of the strategies used by developing nations to address these concerns.
Write c program that allows user to make ledger transactions : Write a C program that allows the user to make some ledger transactions. The program should first prompt the user to enter the current balance of his/her ledger account (must allow for dollars and cents, and not less than zero).

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd