Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Design a Payroll class with the following fields: Design a Payroll class with the following fields: name: a String containing the employee's name idNumber:

JAVA

Design a Payroll class with the following fields:

Design a Payroll class with the following fields: name: a String containing the employee's name idNumber: an int representing the employee's ID number rate: a double containing the employee's hourly pay rate hours: an int representing the number of hours this employee has worked The class should also have the following methods: Constructor: takes the employee's name and ID number as arguments Accessors: allow access to all of the fields of the Payroll class Mutators: let the user assign values to the fields of the Payroll class grossPay: returns the employee's gross pay, which is calculated as the number of hours worked times the hourly pay rate. Write another program that demonstrates the class by creating a Payroll object, then asking the user to enter the data for an employee in the order: name, ID number, rate, hours. The program should then print out a statement in the following format (for example, if you had an employee named Chris 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.

This lab exercise is from starting out with control structures in Java. I have tried some of the codes I've seen here and they do work in my IDE however, on the myprogramming site specifically none of the answers and neither were my original one accepted by this program.

image text in transcribed

WORK AREA RESULTS Design a Payroll class with the following fields ,name: a Strina conta nina the emplayee's name idNumber: an int representing the employee's ID number . rate: a double containing the emplayee's haurly pay rate hours: an int representing the number of hours this emploree has worked The class should also have the following methads Cornstntr: takes the employee's nama and ID number as arguments . Accessors: aloww access to all of the fields of the Payroll class Mutators: let the user assign aluBs to the fields of the Parroll dass .grossPay: retums the employee's gross pay, which is calculated as the number of hours worked times the hourly pay rate Wnite another arngram that demonstrates the lass ty creating a Parroll ahjad, then asking the user to enter the data for an employee in the order: name, ID number, rate, hours The program should then print out a statamnt in the following format (for example, if you had an employee named Chris 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 tert forming so that the gross pay is rounded to two decimal places. SAMPLE RUN #3: java Payroll Standand Output Enter ewplogee 'a nane:Ente elovee' ID unber:Enter hoarly rate:Ener mber of hours uoxked:Hermione Grenger, euplogee mbe 107548 ade 4522. 50 in gro83 pey

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

Second derivatives Find d 2 y / dx 2 . x + y 2 = 1

Answered: 1 week ago