Implement a class Paycheck. A Paycheck is defined by a wage (per hour), hours worked (be sure to accept fractional hours), and a tax rate. Any overtime work (over 40 hours per week) is paid at double...


Java. Please use the template, thank you!


Implement a class Paycheck. A Paycheck is defined by a wage (per hour), hours worked (be sure to<br>accept fractional hours), and a tax rate. Any overtime work (over 40 hours per week) is paid at double the<br>regular wage. Taxes are removed based on the total earned, including overtime.<br>Your job is to compute the total pay for that paycheck and return it in the : getPay method. Implement<br>the Paycheck class using the template provided here: Paycheck.java I.<br>Assume all input values are valid and non-negative.<br>Examples:<br>Paycheck pl<br>new Paycheck (10.5, 42, 0);<br>pl.getPay (); // returns 462.0<br>Paycheck p2<br>new Paycheck (10.5, 42, 10);<br>p2.getPay (); // returns 415.8<br>Paycheck p3<br>new Paycheck (10.5, 40, 10);<br>p3. getPay (); // returns 378<br>Paycheck p4<br>new Paycheck (10.5, 33.2, 25);<br>p4.getPay (); // returns 261.45<br>Paycheck p5<br>new Paycheck (100.33, 65.5, 20);<br>p5.getPay (); // returns 7304.024<br>

Extracted text: Implement a class Paycheck. A Paycheck is defined by a wage (per hour), hours worked (be sure to accept fractional hours), and a tax rate. Any overtime work (over 40 hours per week) is paid at double the regular wage. Taxes are removed based on the total earned, including overtime. Your job is to compute the total pay for that paycheck and return it in the : getPay method. Implement the Paycheck class using the template provided here: Paycheck.java I. Assume all input values are valid and non-negative. Examples: Paycheck pl new Paycheck (10.5, 42, 0); pl.getPay (); // returns 462.0 Paycheck p2 new Paycheck (10.5, 42, 10); p2.getPay (); // returns 415.8 Paycheck p3 new Paycheck (10.5, 40, 10); p3. getPay (); // returns 378 Paycheck p4 new Paycheck (10.5, 33.2, 25); p4.getPay (); // returns 261.45 Paycheck p5 new Paycheck (100.33, 65.5, 20); p5.getPay (); // returns 7304.024
2<br>30 /**<br>4<br>* This class models a paycheck.<br>*/<br>6 public class Paycheck {<br>7<br>// ADD YOUR INSTANCE VARIABLES HERE<br>8.<br>/ **<br>10<br>Constructs a PayCheck for a given week.<br>*<br>11<br>the employee's hourly wage<br>* @param wage<br>* @param hours<br>* @param taxRate<br>*/<br>12<br>13<br>the amount of hours worked<br>14<br>percentage this employee is taxed<br>15<br>public Paycheck(double wage, double hours, double taxRate) {<br>// FILL IN<br>}<br>160<br>17<br>18<br>19<br>200<br>/**<br>21<br>* Gets the pay for this week<br>*<br>22<br>* @return the pay, including overtime if earned, and taxes taken out on<br>* the full amount earned<br>23<br>24<br>25<br>*/<br>public double getPay () {<br>return -1.0; // FIX ME<br>}<br>260<br>27<br>28<br>29 }<br>30<br>

Extracted text: 2 30 /** 4 * This class models a paycheck. */ 6 public class Paycheck { 7 // ADD YOUR INSTANCE VARIABLES HERE 8. / ** 10 Constructs a PayCheck for a given week. * 11 the employee's hourly wage * @param wage * @param hours * @param taxRate */ 12 13 the amount of hours worked 14 percentage this employee is taxed 15 public Paycheck(double wage, double hours, double taxRate) { // FILL IN } 160 17 18 19 200 /** 21 * Gets the pay for this week * 22 * @return the pay, including overtime if earned, and taxes taken out on * the full amount earned 23 24 25 */ public double getPay () { return -1.0; // FIX ME } 260 27 28 29 } 30
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here