Write a program that computes the salaries for a employees

Assignment Help Programming Languages
Reference no: EM131274233

Assignment

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:

1. A constructor that allows the name and monthly salary to be initialized.

2. A method named annualSalary that returns the salary for a whole year.

3. 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:

1. A constructor that allows the name, monthly salary and annual sales to be initialized.

2. 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.

3. 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:

1. A constructor that allows the name, monthly salary and stock price to be initialized.

2. 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.

3. 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. 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.

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.

Reference no: EM131274233

Questions Cloud

Discriminative frequent pattern-based classification : Compare and contrast associative classification and discriminative frequent pattern-based classification. Why is classification based on frequent patterns able to achieve higher classification accuracy in many cases than a classical decision-tree ..
Is there anything that occurred in the child environment : What was the outcome of this stage for you? Did anything happen in your life prior to that stage that affected the outcome? How does the outcome from that stage affect how you are today? Provide specific details that demonstrate your understanding..
Open source or proprietary web server software : From the third e-Activity, identify a company (bank, car wash, travel agency, nonprofit, restaurant, etc.) and suggest whether you think it should choose to use Open Source or Proprietary Web Server software and explain why. Support your opinion w..
Troubleshooting web forms : Imagine that a local college hired you to look at a lengthy form on the university's office of admissions Website. Prospective students have been calling the office to request information instead of utilizing the university's Website. The form con..
Write a program that computes the salaries for a 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.
Credit card is mastercard or visa card : First your program should ask if the credit card is MasterCard or visa card. Then ask the 16 digit credit card number. Then add all the digits in the credit card number and get the modulo 10.
Commercial intrusion prevention systems : Contact the vendors of 2 commercial intrusion prevention systems and ask them at least 3 questions of your own choice about the products capabilities.
Design a basic file transfer protocol command line tool : Design and implement a basic File Transfer Protocol command line tool. When executed, the tool will display a simple ftp> prompt in console where the user can enter commands to upload and download files from a remote server.
Identify an issue currently in the news that relate federal : Evaluate what this development may mean for your work in health care administration.

Reviews

Write a Review

Programming Languages Questions & Answers

  Display the main menu in a loop

CPCS202 - You need to display the main menu in a loop! Why? Because after the customer makes their choices, the menu should appear again. The customer can then exit the system or perform other services.

  Create a class-how to cash goods-give change to customers

Write class called Cashier that directs a cashier how to cash goods and give change to customers. Typical cashier operations are as follows.

  Enter codes of one to eight characters along

Consider a program to enter codes of one to eight characters along with an associated telephone number and associated notes. A code can represent a person's name, a person's initials, a place, or anything.

  Shell script that will count the number of files in account

Modify the script to get it to back up to "X" number of days and list the files that were modified for each day.

  Write down public static method using public interface

Using only public interface of UnorderedLinkedList class, write down a method: public static void reverse(UnorderedLinkedList staff) that reverses the entries in a linked list.

  Impact of information technology breakdowns

In today is highly interconnected world, we take information systems and technology for granted. We realize the important role they play only when things go wrong or fail (i.e. breakdowns). To complete this assignment, you will be identifying two ..

  Estimate probability of default for a credit application

What would you suggest as the target variable and what would you recommend that Joe do to achieve his business goal?

  Write a function that accepts temperature in degrees

write a function that accepts temperature in degrees fahrenheit degf andcomputes the corresponding value in degrees

  How long will it take the program to run

How long will it take the program to run with 1000 processors, if each processor is as fast as the single processor on which the serial program was run?

  Write a program that tests a sequence has an at repeat

Write a program that tests to see whether a sequence has an AT repeat - Return a message to the user whether or not an AT repeat exits in the sequence. Use at least one subroutine.

  Design of implementation codes-object oriented programming

Supporting document is required to reflect design of implementation codes and implementation details which utilises object oriented programming concepts.

  Write program to input number of hours worked

Write a program that allows the user to input the number of hours worked and hourly pay rate for employees and outputs their total pay.

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