Trace through the following program and Show the Ol public class Employee { private static int empID = 11111; private String name , position; double salary; public Employee(String name) { empID ++; this.name = name; public Employee(Employee obj) { empID = obj.empID; - obj.naтe; position = obj.position; %3D пате 3 public void empPosition(String empPosition) {position = empPosition;} public void empSalary(double empSalary) { salary = empSalary;} public String toString() { return name + " "+ empID + !3! + position +" $"+ salary; public void setName(String empName){ name = public static void main(String args]) { Employee empOne = new Employee("James Smith"), empTwo; еmpName;} %3D empOne.empPosition("Senior Software Engineer"); етрОпе.етpSalary(1000); System.out.println(empOne); empTwo = emp0ne ; етpTwo.empPosition("CEO"); System.out.println(empOne); System.out.println(empTwo);

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 14PE
icon
Related questions
Question
100%
Trace through the following program and show the output. Show your work for partial credit.
public class Employee {
private static int empID = 1111l;
private String name , position;
double salary;
public Employee(String name) {
empID ++;
this.name 3 пате;
}
public Employee(Employee obj) {
empID = obj.empĪD;
пате %3D оbj.naте;
position = obj.position;
%3D
public void empPosition(String empPosition) {position = empPosition;}
public void empSalary(double empSalary) { salary = empSalary;}
public String toString() {
return name + " "+empID + "
"+ position +" $"+salary;
public void setName(String empName){ name = empName;}
public static void main(String args[]) {
Employee empOne = new Employee("James Smith"), empTwo;
%3D
empOne.empPosition("Senior Software Engineer");
етрOпе.етpSalary(1000);
System.out.println(empOne);
еmpTwo
empTwo.empPosition("CEO");
System.out.println(empOne);
System.out.println(empTwo);
%3D етpОпе
empOne ;
Transcribed Image Text:Trace through the following program and show the output. Show your work for partial credit. public class Employee { private static int empID = 1111l; private String name , position; double salary; public Employee(String name) { empID ++; this.name 3 пате; } public Employee(Employee obj) { empID = obj.empĪD; пате %3D оbj.naте; position = obj.position; %3D public void empPosition(String empPosition) {position = empPosition;} public void empSalary(double empSalary) { salary = empSalary;} public String toString() { return name + " "+empID + " "+ position +" $"+salary; public void setName(String empName){ name = empName;} public static void main(String args[]) { Employee empOne = new Employee("James Smith"), empTwo; %3D empOne.empPosition("Senior Software Engineer"); етрOпе.етpSalary(1000); System.out.println(empOne); еmpTwo empTwo.empPosition("CEO"); System.out.println(empOne); System.out.println(empTwo); %3D етpОпе empOne ;
position
}
public void empPosition(String empPosition) {position = empPosition;}
public void empSalary(double empSalary) { salary = empSalary;}
public String toString() {
return name + " "+empID + "
"+ position +" $t + salary;
public void setName(String empName){ name = empName;}
public static void main(String args[]) {
Employee emp0ne = new Employee("James Smith"), empTwo;
empOne.empPosition("Senior Software Engineer");
етрOnе.eтpSalary(1000);
System.out.println(empOne);
empTwo = empOne;
emp Two.empPosition("CEO");
System.out.println(empOne);
System.out.println(empTwo);
empOne = new Employee(empTwo);
етрOпе.етpSalary(12500);
empTwo.setName("Mary Anne");
empTwo.empPosition("Senior Software Engineer");
System.out.println(empOne);
System.out.println(empTwo);
Transcribed Image Text:position } public void empPosition(String empPosition) {position = empPosition;} public void empSalary(double empSalary) { salary = empSalary;} public String toString() { return name + " "+empID + " "+ position +" $t + salary; public void setName(String empName){ name = empName;} public static void main(String args[]) { Employee emp0ne = new Employee("James Smith"), empTwo; empOne.empPosition("Senior Software Engineer"); етрOnе.eтpSalary(1000); System.out.println(empOne); empTwo = empOne; emp Two.empPosition("CEO"); System.out.println(empOne); System.out.println(empTwo); empOne = new Employee(empTwo); етрOпе.етpSalary(12500); empTwo.setName("Mary Anne"); empTwo.empPosition("Senior Software Engineer"); System.out.println(empOne); System.out.println(empTwo);
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning