Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Programming Project. This has to be done in NetBeans 8.2. Also I have no idea how to get a program on NetBeans to read

Java Programming Project. This has to be done in NetBeans 8.2. Also I have no idea how to get a program on NetBeans to read a .txt file. There also needs to be screen shots of everything and test cases. I need to be able to easily copy and paste everyhting over to NetBeans 8.2.

The first programming project involves writing a program that computes the salaries for a collection of employees of different types. This program consists of four classes. 1. The first class is the Employee class, which contains the employee's name and monthly salary, which is specified in whole dollars. It should have three methods: a. A constructor that allows the name and monthly salary to be initialized. b. A method named annualSalary that returns the salary for a whole year. c. A toString method that returns a string containing the name and monthly salary, appropriately labeled. 2. The Employee class has two subclasses. The first is Salesman. It has an additional instance variable that contains the annual sales in whole dollars for that salesman. It should have the same three methods: a. A constructor that allows the name, monthly salary and annual sales to be initialized. b. An overridden method annualSalary that returns the salary for a whole year. The salary for a salesman consists of the base salary computed from the monthly salary plus a commission. The commission is computed as 2% of that salesman's annual sales. The maximum commission a salesman can earn is $20,000. c. An overridden toString method that returns a string containing the name, monthly salary and annual sales, appropriately labeled. 3. The second subclass is Executive. It has an additional instance variable that reflects the current stock price. It should have the same three methods: a. A constructor that allows the name, monthly salary and stock price to be initialized. b. An overridden method annualSalary that returns the salary for a whole year. The salary for an executive consists of the base salary computed from the monthly salary plus a bonus. The bonus is $30,000 if the current stock price is greater than $50 and nothing otherwise. c. An overridden toString method that returns a string containing the name, monthly salary and stock price, appropriately labeled. 4. Finally there should be a fourth class that contains the main method. It should read in employee information from a text file. Each line of the text file will represent the information for one employee for one year. An example of how the text file will look is shown below: 2014 Employee Smith,John 2000 2015 Salesman Jones,Bill 3000 100000 2014 Executive Bush,George 5000 55 The year is the first data element on the line. The file will contain employee information for only two years: 2014 and 2015. Next is the type of the employee followed by the employee name and the monthly salary. For salesmen, the final value is their annual sales and for executives the stock price. As the employees are read in, Employee objects of the appropriate type should be created and they should be stored in one of two arrays depending upon the year. You may assume that the file will contain no more than ten employee records for each year and that the data in the file will be formatted correctly. Once all the employee data is read in, a report should be displayed on the console for each of the two years. Each line of the report should contain all original data supplied for each employee together with 2 that employee's annual salary for the year. For each of the two years, an average of all salaries for all employees for that year should be computed and displayed. The google recommended Java style guide, provided as link in the week 2 content, should be used to format and document your code. Specifically, the following style guide attributes should be addressed: ? Header comments include filename, author, date and brief purpose of the program. ? In-line comments used to describe major functionality of the code. ? Meaningful variable names and prompts applied. ? Class names are written in UpperCamelCase. ? Variable names are written in lowerCamelCase. ? Constant names are in written in All Capitals. ? Braces use K&R style. In addition the following design constraints should be followed: ? Declare all instance variables private ? Avoid the duplication of code Test cases should be supplied in the form of table with columns indicating the input values, expected output, actual output and if the test case passed or failed. This table should contain 4 columns with appropriate labels and a row for each test case. Note that the actual output should be the actual results you receive when running your program and applying the input for the test record. Be sure to select enough different kinds of employees to completely test the program. Note: All code should compile and run without issue. Submission requirements Deliverables include all Java files (.java) and a single word (or PDF) document. The Java files should be named appropriately for your applications. The word (or PDF) document should include screen captures showing the successful compiling and running of each of the test cases. Each screen capture should be properly labeled clearly indicated what the screen capture represents. The test cases table should be included in your word or PDF document and properly labeled as well. Submit your files to the Project 1 assignment area no later than the due date listed in your LEO classroom. You should include your name and P1 in your word (or PDF) file submitted (e.g. firstnamelastnameP1.docx or firstnamelastnameP1.pdf)

This is the .txt file

2014, Employee, Smith, John, 2000,0 2015, Salesman, Jones, Bill, 3000,100000 2014, Executive, Bush, George, 5000,55 2015, Employee, Brevis, Philomenia, 2055,0 2014, Employee, Fall, Beatrice, 1870,0 2015, Executive, Washington, Clarie, 4050,45 2015, Employee, Poole, Albert, 2150, 0 2014, Employee, Able, Paul, 2120, 0 2015, Salesman, Naismith, Frederick, 2100, 90000 2015, Employee, Zane, Xavier, 30100, 0 2014, Salesman, Caldwell, Millicent, 2800, 120000 2015, Employee, Peters, Clovis, 1800, 0 2014, Employee, Syung, Susan, 1800, 0 2015, Employee, Jones, Redding, 2090, 0 2014, Salesman, Jones, Bill, 3000, 100000 2014, Employee, Marshall, Horace, 2300, 0 2015, Executive, Tinker, Willieam, 5590, 59

OBTAINING DATA FOR ASSIGNMENT 1

For Project 1, you need to read in a file and assign the data to two arrays. In Item 4 of the pdf assignment there is a description of the elements that are contained in a file. There are three lines displayed as examples of the data in the file. The assignment invites you to make your own appropriate file based on those examples. To help insure consistency in grading and conversation among the members of the class, I have created a file that contains all the data that is exemplified by those three lines: Employee.txt. The file is a comma delimited file. There is only one difference between the example line for Employee and the actual file: I added a 0 in the sixth field of each line for the Employee field to make it consistent with the Salesman and Executive elements that already contain six lines. The following is the description of the file:

Employee Year Record

Employee Type

Employee Last Name

Employee First Name

Employee Monthly Pay

Employee Special Value

o For Employee additional annual pay is 0

o For Salesman additional annual pay is sales > sales * .02 up to $20,000

o For Executive additional annual pay is stock price: > if 50 or more then $30,000 added

To help in the coding of the assignment, there is an example of source code (Reading File Into Array.docx) that could be used in both reading a file into a program and assigning the fields into a two-dimensional array. The source code is an attachment in Project 1. There is a file also attached (ArrayReadComma.txt) to help illustrate the use of the source code.

Review the Suggested Design to help clarify the instructions of the assignment. You might find the alterative version of the assignment detailed below more comfortable to you.

?

SUGGESTED DESIGN FOR ASSIGNMENT 1

Here is one skeleton design of this program.

package cmis242.prj1smithx;

[imports here]

public class CMIS242 PRJ1SmithX {

public static class Data Manipulation {

[Declare two arrays for years]

[METHOD: Coding to read in file and assign to appropriate array]

[MEHTOD(s): update the various rows of each array]

[METHOD: Display the output]

} //end public static Data Manipulation

public static class Employee {

[Constructor (), annual salary, and toString]

} // end public static class Employee

public static class Salesman extends Employee {

[Constructor (), annual salary, and toString]

} // end public static class Salesman extends Employee

public static class Executive extends Employee {

[Constructor (), annual salary, and toString]

} // end public static class Executive extends Employee

public static void main (String args[]) {

[Declare instance of class]

[Call to read and assign file]

[Call to display output]

} // end public static void main (String args []) {

} // end public class CMIS242 PRJ1SmithX

?

SUGGESTED OUTPUT FOR ASSIGNMENT 1

Below is one example of possible output for the program. [Note: Avoid the use of the tab key; it generates inconsistent results. The font type for the example is Courier New.]

[Your Name] Corporation

Employee name Type Monthly Pay Sales Stock Bonus Annual Pay

________________________________________________________________________________________________

John Smith Employee 2000.00 24000.00

George Bush Executive 5000.00 55.00 30000.00 90000.00

Bill Jones Salesman 3000.00 100000.00 2000.00 38000.00

Report for 2014 Employees: Average Salary is 999.99 [The 9 is used to demonstrate numbers.]

Fredrick Naismith Salesman 2100.00 90000.00 1800.00 27000.00

Report for 2015 Employees: Average Salary is 74335.56

Average Salary Difference between two years

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

c. Determine the confidence intervals of the linearised parameters.

Answered: 1 week ago