Question (2) Create a new package (employee2), solve the error and trace the output import employee.Employee; public class employee2 { public static void main(String[] args) { Employee empl = new Employee(); emp1.firstName = "Ali"; empl.lastName = "Omar"; empl.salary = 20000; empl.employeeSalary(); empl.checkEmployeeSalary(emp1.salary, 5000); }
Question (2) Create a new package (employee2), solve the error and trace the output import employee.Employee; public class employee2 { public static void main(String[] args) { Employee empl = new Employee(); emp1.firstName = "Ali"; empl.lastName = "Omar"; empl.salary = 20000; empl.employeeSalary(); empl.checkEmployeeSalary(emp1.salary, 5000); }
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![Question (2)
Create a new package (employee2), solve the error and trace the output
import employee.Employee;
public class employee2 {
public static void main(String[] args) {
Employee empl = new Employee();
empl.firstName = "Ali";
empl.lastName = "Omar";
empl.salary = 20000;
empl.employeeSalary();
empl.checkEmployeeSalary(emp1.salary, 5000);
%3D](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5e87307a-7be8-407c-b410-ab35823c36f1%2Fe2fa1983-c65f-4b21-ac1d-93c9b87b6096%2F7qcgzp_processed.png&w=3840&q=75)
Transcribed Image Text:Question (2)
Create a new package (employee2), solve the error and trace the output
import employee.Employee;
public class employee2 {
public static void main(String[] args) {
Employee empl = new Employee();
empl.firstName = "Ali";
empl.lastName = "Omar";
empl.salary = 20000;
empl.employeeSalary();
empl.checkEmployeeSalary(emp1.salary, 5000);
%3D
![public class Application {
public static void main(String[] args) {
Employee empl = new Employee();
empl.firstName = "Ali";
empl.lastName = "Omar";
empl.salary = 20000;
Employee emp2 = new Employee();
emp2.firstName = "Mohamed";
emp2.lastName = "Nour";
emp2.salary = 30000;
System.out.println("-
System.out.printin("-
empl.employeeSalary();
System.out.println("-
empl.checkEmployeeSalary(emp1.salary, emp2.salary);
System.out.printin("-
System.out.println("-
printEmployee(emp2);
System.out.printin("-
Employee employeeArr[] = new Employee[2]:
employeeArr[0] = empl;
employeeArr[1] = emp2;
Application a = new Åpplication();
a.printArrayofEmployee(employeeArr);
Non static (instance) start to call
Static function to print ---------");
");
- Non Static function to print -
--");
Non static (instance) start to call same class
Static function to print --------);
-");
Non Static function to print ----);
System.out.println("-
System.out.printin("-
System.out.printin("Salary : " + Employee.salary);
Employee.employeeSalary();
System.out.printin("--
System.out.println("Salary : " + Employee.firstName);
Employee.checkEmployeeSalary(empl.salary, emp2.salary);
System.out.printin("-
printEmployee(empl);
printArrayofEmployee(employeeArr);}
public static void printEmployee(Employee e) {
System.out.println("Employee name : "+ e.firstName +" " + e.lastName +
Employee Salary : " + e.salary); }
static start to call
-");
Static Attribute and function ----
"):
Non Static Attribute and function
-"):
static start to call same class-
--"):
public void printArrayOfEmployee(Employee e[]) {
for (int i - 0; i < e.length; i++) {
System.out.println("Employee " + (i + 1) + " Name : " + e[i].firstName +
efi].lastName + " Salary : "+ eſi].salary); }](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5e87307a-7be8-407c-b410-ab35823c36f1%2Fe2fa1983-c65f-4b21-ac1d-93c9b87b6096%2F68sz9n9_processed.png&w=3840&q=75)
Transcribed Image Text:public class Application {
public static void main(String[] args) {
Employee empl = new Employee();
empl.firstName = "Ali";
empl.lastName = "Omar";
empl.salary = 20000;
Employee emp2 = new Employee();
emp2.firstName = "Mohamed";
emp2.lastName = "Nour";
emp2.salary = 30000;
System.out.println("-
System.out.printin("-
empl.employeeSalary();
System.out.println("-
empl.checkEmployeeSalary(emp1.salary, emp2.salary);
System.out.printin("-
System.out.println("-
printEmployee(emp2);
System.out.printin("-
Employee employeeArr[] = new Employee[2]:
employeeArr[0] = empl;
employeeArr[1] = emp2;
Application a = new Åpplication();
a.printArrayofEmployee(employeeArr);
Non static (instance) start to call
Static function to print ---------");
");
- Non Static function to print -
--");
Non static (instance) start to call same class
Static function to print --------);
-");
Non Static function to print ----);
System.out.println("-
System.out.printin("-
System.out.printin("Salary : " + Employee.salary);
Employee.employeeSalary();
System.out.printin("--
System.out.println("Salary : " + Employee.firstName);
Employee.checkEmployeeSalary(empl.salary, emp2.salary);
System.out.printin("-
printEmployee(empl);
printArrayofEmployee(employeeArr);}
public static void printEmployee(Employee e) {
System.out.println("Employee name : "+ e.firstName +" " + e.lastName +
Employee Salary : " + e.salary); }
static start to call
-");
Static Attribute and function ----
"):
Non Static Attribute and function
-"):
static start to call same class-
--"):
public void printArrayOfEmployee(Employee e[]) {
for (int i - 0; i < e.length; i++) {
System.out.println("Employee " + (i + 1) + " Name : " + e[i].firstName +
efi].lastName + " Salary : "+ eſi].salary); }
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
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.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education