Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

Java, Programming

  • Category:- Java
  • Reference No.:- M92053980
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Java

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As