The purpose of this assignment is to write a program that uses loops, file I/O, and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The purpose of this assignment is to write a program that uses loops, file I/O, and methods to process employee salary data and generate a small report. Additionally, you will gain further practice with several concepts that you have already worked with including: strings and string- handling functions; console I/O; and branching. Use of arrays and/or ArrayLists are not allowed. Instruction Your team has been asked to develop a program that accepts two data filenames and an employee name (first & last name) as user input, searches both files for the specified employee's information, and optionally prints a formatted salary schedule for that employee. Separate static methods should be used in your program, as described further in the Solution Design section. Input Files Both input files are plain text files in tab-delimited format. The first line of each file is a header that can be skipped over by your program. Here are a few lines extracted from each input file to show the layout. Employee.txt: EmpLastName Abbott EmpFirstName BirthDate Zoe 4/10/1969 6/25/2020 E55049 Adams Amaya 12/30/1968 5/29/2020 E55042 ... Bauer Dolan 6/26/1960 1/5/2018 E55001 ServiceStartDate EmpID ... EmpSal2022.txt: EmpID MonthlySalary E55001 E55002 FedTax ABTax CPP EI OptRSP 5600 681.85 10000 1679.45 365.8 289.3 88.48 280 812.5 529.07 158 200 Information in the two files is related and the common element, Employee ID or EmpID, is what ties the data together. For example, looking first at the Employee.txt sample above, we can find out that the EmpID for Dolan Bauer is E55001. We can then locate Dolan's salary information in the EmpSal2022.txt file from the line with the matching EmpId E55001, which shows: • • • 5600-gross monthly salary 681.85 – federal monthly income tax _ 365.8 – Alberta monthly income tax 289.3 – monthly CPP payment, up to the maximum of 3,499.80 per year in 2022 88.48 - monthly EI payment, up to the maximum of 952.74 per year in 2022 • 280 monthly optional retirement savings plan (RSP) contribution Test Plan Below are 4 separate sample runs which make up the test plan and demonstrate how your program should obtain user input and present results to the user. User input appears as red bold underline: Sample run #1: Enter employee filename (full path): c:/temp/employee.txt Enter employee first name: Dolan Enter employee last name: Bauer Employee information is found for: Dolan Bauer And employee ID is: E55001 ** Would you want to retrieve the employee salary information (Y/N): Y Enter employee salary filename (full path): c:/temp/empsa12022.txt Salary information for DOLAN BAUER with E55001 is: Monthly Salary: Monthly Federal Tax: $5600.00 $681.85 Monthly Alberta Tax: $365.80 $289.30 ** Monthly CPP: Monthly EI: Monthly Opt. RSP: $88.48 $280.00 ** Would you want to calculate deductions and print salary schedule/year (Y/N): Y Salary Schedule per year: Month Gross Salary Optional Tax CPP ΕΙ RSP Net Salary 1 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 234 LO 2 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 5 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 6 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 7 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 8 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 9 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 10 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 11 5,600.00 1,047.65 289.30 67.94 280.00 3,915.11 12 5,600.00 1,047.65 289.30 0.00 280.00 3,983.05 Total $67,200.00 $12,571.80 $3,471.60 $952.74 $3,360.00 $46,843.86 Sample run #2: Enter employee filename (full path): c:/temp/employee.txt Enter employee first name: orson Enter employee last name: avery Employee information is found for: orson avery And employee ID is: E55059 ******* *********** ** ***************** Would you want to retrieve the employee salary information (Y/N): n Bye... Sample run #3: Enter employee filename (full path): c:/temp/employee.txt Enter employee first name: Kay Enter employee last name: Woodward Employee information is found for: Kay Woodward And employee ID is: E55035 ***************************** ********** Would you want to retrieve the employee salary information (Y/N): Y Enter employee salary filename (full path): c:/temp/empsa12022.txt Salary information for KAY WOODWARD with E55035 is: Monthly Salary: $4700.00 Monthly Federal Tax: $504.15 Monthly Alberta Tax: $276.10 Monthly CPP: $240.25 Monthly EI: $74.26 Monthly Opt. RSP: $0.00 ************************************************** Would you want to calculate deductions and print salary schedule/year (Y/N): n Bye... Sample run #4: Enter employee filename (full path): c:/temp/employee.txt Enter employee first name: Musk Enter employee last name: Kay No employee information is found for: Musk Kay Additional design considerations: • Use the procedural programming approach (i.e. what has been used in this course so far) rather than an object-oriented approach. This program will find and print salary information for a single employee only. In other words the input files will only be read once per execution of the program and you will NOT need to use arrays or other more sophisticated Java data types. Keep file I/O code within the appropriate method (i.e. code to process Employee.txt in the lookupEmployeeID method and code to process EmpSal2022.txt in the printEmployee Salary method). Use the Scanner class to read the files as shown in class and in the course material. The purpose of this assignment is to write a program that uses loops, file I/O, and methods to process employee salary data and generate a small report. Additionally, you will gain further practice with several concepts that you have already worked with including: strings and string- handling functions; console I/O; and branching. Use of arrays and/or ArrayLists are not allowed. Instruction Your team has been asked to develop a program that accepts two data filenames and an employee name (first & last name) as user input, searches both files for the specified employee's information, and optionally prints a formatted salary schedule for that employee. Separate static methods should be used in your program, as described further in the Solution Design section. Input Files Both input files are plain text files in tab-delimited format. The first line of each file is a header that can be skipped over by your program. Here are a few lines extracted from each input file to show the layout. Employee.txt: EmpLastName Abbott EmpFirstName BirthDate Zoe 4/10/1969 6/25/2020 E55049 Adams Amaya 12/30/1968 5/29/2020 E55042 ... Bauer Dolan 6/26/1960 1/5/2018 E55001 ServiceStartDate EmpID ... EmpSal2022.txt: EmpID MonthlySalary E55001 E55002 FedTax ABTax CPP EI OptRSP 5600 681.85 10000 1679.45 365.8 289.3 88.48 280 812.5 529.07 158 200 Information in the two files is related and the common element, Employee ID or EmpID, is what ties the data together. For example, looking first at the Employee.txt sample above, we can find out that the EmpID for Dolan Bauer is E55001. We can then locate Dolan's salary information in the EmpSal2022.txt file from the line with the matching EmpId E55001, which shows: • • • 5600-gross monthly salary 681.85 – federal monthly income tax _ 365.8 – Alberta monthly income tax 289.3 – monthly CPP payment, up to the maximum of 3,499.80 per year in 2022 88.48 - monthly EI payment, up to the maximum of 952.74 per year in 2022 • 280 monthly optional retirement savings plan (RSP) contribution Test Plan Below are 4 separate sample runs which make up the test plan and demonstrate how your program should obtain user input and present results to the user. User input appears as red bold underline: Sample run #1: Enter employee filename (full path): c:/temp/employee.txt Enter employee first name: Dolan Enter employee last name: Bauer Employee information is found for: Dolan Bauer And employee ID is: E55001 ** Would you want to retrieve the employee salary information (Y/N): Y Enter employee salary filename (full path): c:/temp/empsa12022.txt Salary information for DOLAN BAUER with E55001 is: Monthly Salary: Monthly Federal Tax: $5600.00 $681.85 Monthly Alberta Tax: $365.80 $289.30 ** Monthly CPP: Monthly EI: Monthly Opt. RSP: $88.48 $280.00 ** Would you want to calculate deductions and print salary schedule/year (Y/N): Y Salary Schedule per year: Month Gross Salary Optional Tax CPP ΕΙ RSP Net Salary 1 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 234 LO 2 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 5 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 6 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 7 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 8 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 9 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 10 5,600.00 1,047.65 289.30 88.48 280.00 3,894.57 11 5,600.00 1,047.65 289.30 67.94 280.00 3,915.11 12 5,600.00 1,047.65 289.30 0.00 280.00 3,983.05 Total $67,200.00 $12,571.80 $3,471.60 $952.74 $3,360.00 $46,843.86 Sample run #2: Enter employee filename (full path): c:/temp/employee.txt Enter employee first name: orson Enter employee last name: avery Employee information is found for: orson avery And employee ID is: E55059 ******* *********** ** ***************** Would you want to retrieve the employee salary information (Y/N): n Bye... Sample run #3: Enter employee filename (full path): c:/temp/employee.txt Enter employee first name: Kay Enter employee last name: Woodward Employee information is found for: Kay Woodward And employee ID is: E55035 ***************************** ********** Would you want to retrieve the employee salary information (Y/N): Y Enter employee salary filename (full path): c:/temp/empsa12022.txt Salary information for KAY WOODWARD with E55035 is: Monthly Salary: $4700.00 Monthly Federal Tax: $504.15 Monthly Alberta Tax: $276.10 Monthly CPP: $240.25 Monthly EI: $74.26 Monthly Opt. RSP: $0.00 ************************************************** Would you want to calculate deductions and print salary schedule/year (Y/N): n Bye... Sample run #4: Enter employee filename (full path): c:/temp/employee.txt Enter employee first name: Musk Enter employee last name: Kay No employee information is found for: Musk Kay Additional design considerations: • Use the procedural programming approach (i.e. what has been used in this course so far) rather than an object-oriented approach. This program will find and print salary information for a single employee only. In other words the input files will only be read once per execution of the program and you will NOT need to use arrays or other more sophisticated Java data types. Keep file I/O code within the appropriate method (i.e. code to process Employee.txt in the lookupEmployeeID method and code to process EmpSal2022.txt in the printEmployee Salary method). Use the Scanner class to read the files as shown in class and in the course material.
Expert Answer:
Answer rating: 100% (QA)
Prompt the user to input the filenames for the employee data and salary data Prompt the user to input the first and last name of the employee they wan... View the full answer
Related Book For
Data Modeling and Database Design
ISBN: 978-1285085258
2nd edition
Authors: Narayan S. Umanath, Richard W. Scammel
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Terminology Key: Key Word List Describe Explain What to do In bulleted, numbered or paragraph form, provide a number of consecutive items-if paragraph form, use commas (,) to separate items In...
-
Your grandparents would like to establish a trust fund that would pay annual payments to you and your heirs of $100,000 a year forever. How much do your parents need to deposit into this trust fund...
-
Five "pours" of metals have had 5 core samples each analyzed for the amount of a trace element. The data for the 5 randomly selected pours are as follows:(a) The intent is that the pours be...
-
A Carnot refrigerator rejects \(3000 \mathrm{kj}\) of heat at \(400 \mathrm{k}\) while using \(1000 \mathrm{kj}\) of work. The lowest operating temperature in the cycle should be: (a) \(15^{\circ}...
-
Organize Meeting and Interpretation (OMI) is an international organization that offers event organization for world leaders to gather and discuss important world issues. OMI determines the location...
-
Calculate the tension in the following figure: T 30 30 250 N T2
-
Exercise 3 used GSS data on the number of hours worked per week for a sample of 32 Latino adults. a. Calculate the mean number of hours worked per week. b. Compare the value of the mean with those...
-
Give four categories of uses of dynamic modeling. List advantages and disadvantages of experimental modeling over analytical modeling.
-
While Ben looked through the resources on the IRS website, he found "fill - in forms" available. How do these forms differ from tax preparation software?
-
Financial responsibility is a key factor in performance evaluation of all managers. Mr Adam believes that his policy of allowing the divisional managers to participate in the budget process and...
-
Assume that a large firm buys all the farms in northern Florida and becomes the only employer of farm workers in the northern half of the state. Explain how the competitive labor market functioned...
-
Sketch the phase characteristic of the Bode plot for the following frequency response: H(j)= 36 (0.5jo + 1) (jo) (0.02 jo+1)
-
Politeness in Social Media. Much of the thinking and research on listening and politeness has focused on them as face-to-face communication skills. How would you describe listening politeness on the...
-
GCSE speech about discrimination[NOT TYPE OF DISCRIMINATION FOR EXAMPLE RACIAL DISCRIMINATION BUT DISCRIMINATION IN GENERAL]+main message INTRO - who what why what can we behave about it? talk about...
-
What kind of rays are X-rays?
-
Describe mutual referencing and the complexities that it introduces.
-
Display the sum along with the cumulative sum of the production of milk across the regions for the 2006-2010 period starting with January and ending the December?
-
Consider the universal relation schema INVENTORY (Store#, Item, Vendor, Date, Cost, Units, Manager, Price, Sale, Size, Color, Location) and the constraint set F {fd1, fd2, fd3, fd4, fd5, fd6, fd7}...
-
Verify the log-likelihood in equation (16.4) for the Tobit model. In L = = In { 1-0 (x-di)} 1:y=di 122. + (y; - x) 02 (16.4) i:y;>di
-
Two Population Poissons. We can express the two population problem in a regression context using one explanatory variable. Specifically, suppose that \(x_{i}\) only takes on the values of zero and...
-
Due to the Covid recession of 2020, the U.S. government budget changed from smaller deficits to very large deficits. What impact would this have on the net exports and private sector balances, all...
Study smarter with the SolutionInn App