联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Algorithm 算法作业Algorithm 算法作业

日期:2024-10-16 06:02

Introduction to Java CS9053 Section I2

Friday, October 11, 2024

Due: Saturday, October 19, 2024 11:59pm

Part I

A polynomial is given by:

In part I, create fill out the Polynomial class using a constructors that will take a String or Array of Doubles as input representing the coefficients an,…a0, and implement the mult method, which takes another Polynomial and returns a new Polynomial object representing the product of the two Polynomial objects.

Then implement y, taking a value of x and returning the result of the polynomial

Finally, implement toString such that the polynomial with coefficients 5, 4, 3 has the output:

3x^2 + 4x + 5

(assuming you choose to say that the ith index of the ArrayList represents ai)

I’ve implemented this with an ArrayList field but you can do it however you like with the coefficients in whatever order you like.

Part II

We have a file employeelist.txt. This contains a list of employees and their associated classes. You can see that the concrete subclasses of Employee are HourlyEmployee, SalariedEmployee, and Manager. Each Employee object has a Manager represented by the id value, except for Employee 0, whose manager is -1. An abstract method called caculateAnnualSalary calculates the annual salary for that Employee, which will be different depending on the nature of how they are paid.

SalariedEmployees have a weekly salary. HourlyEmployees have an hourly rate and a number of hours scheduled per week. Managers have a weekly salary and a maximum bonus (a 10% bonus having the value of 0.1).

In the file CalculateYearlyPayroll.java,  in the file employeelist.txt, using the split method for each like you read in to split the comma-separated values and create the appropriate Employee object in parseEmployee. parseEmployee should throw an UNCHECKED EmployeeTypeException with a useful  Exception message if the Employee subclass is one that doesn’t currently exist.

Put each Employee object in the ArrayList allEmployees, which should not be able to accept any objects other than Employee objects.

Finally, calculate the min and max payroll for the year, assuming 52 weeks in the year and the possibility that all bonuses could be 0% to the maximum possible bonus. This also means that you may want to add other methods and so on to make the min and the max possible salary of a Manager easy to calculate.





版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp