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

  Implement a program that will play the old guessing game

Your assignment is to implement a program that will play the old guessing game "I'm thinking of a number between 1 and 100". The program will be in a webpage

  Write a recursive program

Write a recursive program to compute the number of ways in which an integer k can be written as sum

  Write a java program that asks the user for his/her gender

According to researchers at Stanford Medical School, the ideal weight for a woman is found by multiplying her height in inches by 3.5 and subtracting 108.

  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.

  Bull write a blog article for a coding and technical

bull write a blog article for a coding and technical community blog.bull the length of the article is to be between 500

  What is the most restrictive access modifier

What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package?

  Write a script that clears the screen

Write a script that clears the screen, determines how many sessions you are in (use who, grep, and wc), compare 2 files that are passed as parameters using diff and cmp, and sort the first file.

  Application for an animal-fur trimming service

Create an application for an animal-fur trimming service. Write the code for the application. Prompt the user to indicate how many animals. Display the total fee for one year. Be pleasant in your output as it will be expensive.

  Develop a similar class hierarchy for animals

Java programmers can use class hierarchies for the purposes of inheritance. Develop a similar class hierarchy for Animals

  Implement a class called shortaddress

inally write an application class to allow the user to input an address details and then give the user the choice of viewing the short address details or the long address details. This means your final answer should have a minimum of 3 classes for..

  A listener for the click events of a button

What happens if you fail to register an object as a listener for the click events of a button?

  Find the greatest common divisor between two inputed integer

I have to write an interactive program that will find the Greatest common divisor between two inputted integers.

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