Computes the salaries for a collection of employees

Assignment Help JAVA Programming
Reference no: EM13830001

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. 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 constructor that allows the name and monthly salary to be initialized. A method named annualSalary that returns the salary for a whole year. A toString method that returns a string containing the name and monthly salary, appropriately labeled. 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 constructor that allows the name, monthly salary and annual sales to be initialized. 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. An overridden toString method that returns a string containing the name, monthly salary and annual sales, appropriately labeled. 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 constructor that allows the name, monthly salary and stock price to be initialized. 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. An overridden toString method that returns a string containing the name, monthly salary and stock price, appropriately labeled. Finally there should be a fourth class that contains the main method. It should read in employee information from a text file data.txt. 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 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. Your program should compile without errors. Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of employees to completely test the program. The program should be completed in Netbeans IDE 8.0.2 

Reference no: EM13830001

Questions Cloud

What is the function of and where do you find epithelial : What Is The Function Of And Where Do You Find Epithelial Tissues
Compare the present value with the equipment cost : You are considering buying a piece of industrial equipment to automate a part of your production process. This automation will save labor costs by as much as $35,000 per year over 10 years. The equipment will cost $200,000. Should you purchase the eq..
What is the purpose of public , protected keywords in java : What is the purpose of public , protected keywords in java?
Write a summary on article why chinese mothers are superior : The problem is an article summary about Amy Chua's "Why Chinese Mothers are Superior". The article written by Amy Chua about traditional Chinese parenthood.
Computes the salaries for a collection of employees : 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. The first class is the Employee class, which contains the employee's name and..
Describe how industry will adjust in the long run : A monopolistically competitive firm is operating in the short run, is operating at the optimal level of output, and is earning positive economic profits. Describe how this industry will adjust in the long run.
About oligopoly that warrants an entire body of law : Why do the United States and many other countries have antitrust laws on the books? What's so harmful about oligopoly that warrants an entire body of law?
Types of tissues in human body and characteristics : Types Of Tissues In Human Body And Characteristics Of Epithelial Tissues
Demand curve for perfectly competitive firm is horizontal : Why is the demand curve for a monopolist downward sloping, while the demand curve for the perfectly competitive firm is horizontal?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a program that converts number from binary to decimal

write a program that Converts a Number from Binary to Decimal  by using reading keyboard input.

  Problem 1 the queue adta queue is a fundamental abstract

problem 1. the queue adta queue is a fundamental abstract data type. it is an ordered collection of items in which the

  Create dict letter frequencies that reads the file

createDictLetterFrequencies that reads the file and also takes a parameter n. This method should return a dictionary of dictionaries. The outer dictionary associates the previous n letters of a word with an inner dictionary, which indicates the frequ..

  Scenario - clinic management system

Change the category of a doctor - Clinic Management System - Java client application that perform

  Write a method called makerow

Write a method called makeRow that is passed two arguments: an int and a String. It returns a String containing n copies of s, concatenated in a row. For instance, if we call the method with makeRow(5, "*"), the method returns *****.

  Create a package called people

Create a second package called ‘task01'. Within this package provide classes which perform the following tasks.

  Print the number of lines the number of words

a java program where im supposed to print the number of lines the number of words and the longest line in a text file!

  What is a specific example of a javascript application

What is the purpose of using JavaScript(r) on a website? What is a specific example of a JavaScript(r) application that will be beneficial on the site you are creating

  We will simulate a very simple network by having a process

we will simulate a very simple network by having a process correspond to a node in the network and files correspond to

  Advantages and disadvantages of an arraylist

What are the advantages and disadvantages of an ArrayList? When should you use an ArrayList over a simple array

  What things are you struggling to understand

Discuss your experiences with the programming assignment - what things are you struggling to understand?

  Write a java program that uses the elapsed time

Write a Java program that uses the elapsed time for an event in second and then outputs the elapsed time in hours, minutes and seconds. (For case, if the desired time is 9630 seconds, then the output is 2: 40: 30)

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