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

  Specify, design and implement a class

Specify, design and implement a class that can be used to hold information about a musical note. Test it with an appropriate driver program.

  Design implement test and debug a program with a jframe

design implement test and debug a program with a jframe that allows the user to enter a series of contacts names ages

  Describe the applications functionality

Create an application for Koch's Cottages, a weekend getaway resort that rents cottages and boats to use on the local lake - Add labels as suitable to describe the application's functionality. Save the file as JCottageFrame.java.

  Accepts a string as its parameter and returns an integer

Write a method in java named secondHalfLetters that accepts a string as its parameter and returns an integer representing how many of letters in the string come from the second half of the alphabet

  History of java

Add a class FillInQuestion to the question hierarchy of How To 10.1. An object of this class is constructed with a string that contains the answer, surrounded by _ _, for example, "The inventor of Java was _James Gosling_". The question should be ..

  Program buttons that implements a window with three button

Proper coding conventions required the first letter of the class start with a capital letter and the first letter of each additional word start with a capital letter

  Write the specification for the adt as a java interface

Write the specification for the ADT as a Java interface

  Create a project using the classes in the doc sharing area

create a project using the classes in the Doc Sharing area labeled A Simple LinkedList class. Compile it, run it, and review the code that is given carefully. This code tests the LinkedList class provided in the lecture.

  Create a two dimensional array

COSC 1436: Programming Fundamentals - Create a two dimensional array called snowfalltotal that will hold the values - Define meaningful variable names, but also have to give appropriate names for the physical java file, which should be the same as y..

  Utilization of checked exceptions

There are instances where the utilization of checked exceptions are more appropriate than unchecked exceptions in exception handling. Provide an example of each exception not mentioned in the article. Explain why each type of exception is more app..

  Creating the gui for the game interface

A GUI-based application that allows a user to play a simple trivia game

  Paper on mobility-cdma and gsm

Discuss a minimum of three mobile web applications that are familiar or that you used regularly.

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