subject

Need java payroll classdesign 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 workedthe 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 ofhours worked times the hourly pay rate. write another program that demonstrates the class by creating a payroll object, thenasking 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, ifyou had an employee named chris jacobsen with id number , who works for 5 hours at$10/hr): desired outputchris jacobsen, employee number , made $50.00 in gross pay. here is my problem1) i can not input a first and last namei can input the first name and it works just fine but as soon as i input a space and last name everything breaks loose and the program loses its mind.2) i only have 1 decimal place for the $ i need 2here is my codeimport java. util. scanner; public class payrolltest{public static void main(string args[]){scanner scan = new scanner(system. in); payroll pay = new payroll(); system. out. println("enter the employee's name : " ); string s = scan. next(); pay. setname(s); system. out. println("enter the employee's id : "); int i0 = scan. nextint(); pay. setidnumber(i0); system. out. println("number of hours worked : "); int i = scan. nextint(); pay. sethours(i); system. out. println("hourly pay rate in $ : "); double d = scan. nextdouble(); pay. setrate(d); double total_grosspay = pay. calcgrosspay(); system. out. println(""); system. out. println(""); system. out. println(""+pay. getname() +","+""+"employee number "+pay. getidnumber() +","+ " " +"made $"+total_grosspay +" " +"in gross pay."); }}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
question
Computers and Technology, 24.06.2019 11:40
100 pts. first person gets brainliest
Answers: 2
question
Computers and Technology, 24.06.2019 13:00
Think of a spreadsheet as a giant calculator spread of paper chart data collector
Answers: 2
You know the right answer?
Need java payroll classdesign a payroll class with the following fields: • name: a string containi...
Questions
question
History, 15.07.2019 19:50
Questions on the website: 13722363