subject

Write a class named employee that has the following fields: • name : the name field is a string object that holds the employee's name .• idnumber: the idnumber is an int variable that holds the employee's id number.• department: the department field is a string object that holds the name of the department where the employee works.• position: the position field is a string object that holds the employee's job title. write appropriate mutator methods that store the values in these fields and accessor methods that return thevalues in these fields. once you have written the class , write a separateprogram that creates three employee objects to hold the following data: name id number department positionsusan meyers 47899 marketing sales repmark jones 39119 it programmerjoy rogers 81774 manufacturing engineerthe program should store this data in the three objects and then display the datafor each employee in the format: name , employee number id number, works as a position in department. for example: susan meyers, employee 47899, works as a sales rep in marketing. print each statement on a separate line in the order susan, mark, joy. sample run #0: java employeethe code i wrote: public class employee { // fields private string name; private int idnumber; private string department; private string position; // constructors public employee(string nm, int id, string dp, string ps) { name = nm; idnumber = id; department = dp; position = ps; } public employee(string nm, int id) { name = nm; idnumber = id; department = " "; position = " "; } public employee() { name = " "; idnumber = 0; department = " "; position = " "; } // methods public string getname() { return name; } public int getidnumber() { return idnumber; } public string getdepartment() { return department; } public string getposition() { return position; } }class employeefile{ public static void main(string[] args) { //different employee instances. employee box = new employee("susan meyers", 47899, "accounting", "vice pres"); employee box1 = new employee("mark jones", 39119, "it", "programmer"); employee box2 = new employee("joy rodgers", 81774, "manufacturing", "engineer"); system. out. println(" name id number department position "); system. out. println(""); system. out. print(" " + box. getname() + " " + box. getidnumber() + " " + box.; system. out. println(" " + box.; system. out. print(" " + box1.getname() + " " + box1.getidnumber() + " " + box1.; system. out. println(" " + box1.; system. out. print(" " + box2.getname() + " " + box2.getidnumber() + " " + box2.; system. out. println(" " + box2.; } }problems detected: ⇒ the contents of your standard output is incorrect. ⇒ failed 1 out of 1 test runs. failed test run ⇒ the contents of your standard output is incorrect. the error i got

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:00, king514
6. the is particularly susceptible to the effects of alcohol because it receives a large portion of total blood flow and has a high concentration of neurons. a. heart b. pancreas c. brain d. liver
Answers: 2
image
Computers and Technology, 22.06.2019 21:30, Tcareyoliver
The salespeople at hyperactive media sales all use laptop computers so they can take data with them on the road. you are a salesperson for superduper lightspeed computers talking to hyperactive media sales about upgrading the laptops to windows 10. explain how network location awareness in windows 10 would make the laptops more secure.
Answers: 3
image
Computers and Technology, 22.06.2019 22:50, cheyennecarrillo14
Which is the best minecraft server? a. mineplex b. worldonecraft c. 9b9t d. 2b2t
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, kelseybell5522
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 1
You know the right answer?
Write a class named employee that has the following fields: • name : the name field is a string obj...

Questions in other subjects:

Konu
Chemistry, 22.07.2019 16:00