Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

I need help with two exercises, please.  ATTACHMENT PREVIEW Download attachment

I need help with two exercises, please.

Exercise 71113. Design a Payrollclasswith the following Felds:name: aStringcontaining the employee’sname• idNumber: anintrepresenting the employee’s ID number• rate: adoublecontaining the employee’s hourly pay rate• hours: anintrepresenting the number of hours this employee has workedTheclassshould also have the followingmethods:Constructor: takes the employee’snameand ID number asarguments• Accessors: allow access to all of the Felds of the Payrollclass• Mutators: let the userassignvaluesto the Felds of the Payrollclass• grossPay: returns the employee’s gross pay, which is calculated as the number ofhours worked times the hourly pay rate.Write anotherprogramthat demonstrates theclassby creating a Payrollobject, thenasking the user to enter the data for an employee in the order:name, ID number, rate, hours.Theprogramshould then print out astatementin the following format (for example, ifyou had an employeenamedChris Jacobsen with ID number 11111, who works for 5 hours at$10/hr):Chris Jacobsen, employee number 11111, made $50.00 in gross pay.Using text forming so that the gross pay is rounded to two decimal places.SAMPLE RUN #3:java PayrollEnter·employee’s·name:Hermione·GrangerEnter·employee’s·ID·number:107548Enter·hourly·rate:100.5Enter·number·of·hours·worked:45Hermione·Granger,·employee·number·107548,·made·$4522.50·in·gross·pay.Exercise 71112.Write a Temperatureclassthat will hold a temperature in ±ahrenheit andprovidemethodsto get the temperature in ±ahrenheit, Celsius, and Kelvin. Theclassshould have thefollowing Feld:• ftemp: adoublethat holds a ±ahrenheit temperature.Theclassshould have the followingmethods:Constructor: Theconstructoraccepts a ±ahrenheit temperature (as adouble) andstoresit in theftemp Feld.• set±ahrenheit: The set ±ahrenheitmethodaccepts a ±ahrenheit temperature (as adouble)andstoresit in the ftemp Feld.• get±ahrenheit: Returns thevalueof the ftemp Feld as a ±ahrenheit temperature (noconversionrequired)• getCelsius: Returns thevalueof the ftemp Feld converted to Celsius. Use the following formula toconvert to Celsius:Celsius = (5/9) * (±ahrenheit – 32)• getKelvin: Returns thevalueof the ftemp Feld converted to Kelvin. Use the following formula toconvert to Kelvin:Kelvin = ((5/9) * (±ahrenheit – 32)) + 273Demonstrate the Temperatureclassby writing a separateprogramthat asks the user for a±ahrenheit temperature. Theprogramshould create an instance of the Temperatureclass,
Background image of page 1
with thevalueentered by the user passed to theconstructor. Theprogramshould thencall theobject‘smethodsto display the temperature in the following format (for example,if the temperature in Fahrenheit was -40):The temperature in Fahrenheit is -40.0The temperature in Celsius is -40.0The temperature in Kelvin is 233.0SAMPLE RUN #4:java TemperatureEnter·a·Fahrenheit·temperature:20The·temperature·in·Fahrenheit·is·20.0The·temperature·in·Celsius·is·-6.666666666666667The·temperature·in·Kelvin·is·266.3333333333333
Background image of page 2

Step-

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"