package four; public class Employee { public String name; public int salary; public Employee() { name ="Unknown"; salary = 0; } public Employee(String n,int s) { name = n; salary = s; } void showEmployee() { System.out.print("name: "+name+" "); System.out.print("salary: "+salary+" "); } class Manager extends Employee { public String position; public Manager() { position="unknown"; } public Manager(String n,int s,String p) { super(n,s); position=p; } void showManager() { System.out.printIn("position: "+position); } } class Demo7_ 2 { public static void main(String args[]) { Manager m1=new Manager(); Manager m2=new Manager("Bob",4000,"Sales Manager"); m1.showEmployee(); m1.showManager(); m2.showEmployee(); m2.showManager(); } }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question
100%

here is my Java program.I don't know what's wrong, I can't run it.

package four;
public class Employee
{
public String name;
public int salary;
public Employee()
{ name ="Unknown";
salary = 0;
}
public Employee(String n,int s)
{ name = n;
salary = s;
}
void showEmployee()
{
System.out.print("name:"+name+" ");
System.out.print("salary:"+salary+" ");
}
}
class Manager extends Employee
{
public String position;
public Manager()
{ position="unknown";
}
public Manager(String n,int s,String p)
{ super(n,s);
position=p;
}
void showManager()
{
System.out.println("position:"+position);
}
}
class Demo7_2
{
public static void main(String args[])
{
Manager m1=new Manager();
Manager m2=new Manager("Bob",4000,"Sales Manager");

m1.showEmployee();
m1.showManager();
m2.showEmployee();
m2.showManager();
}
}

package four;
public class Employee
{
public String name;
public int salary;
public Employee()
{ name ="Unknown";
salary = 0;
}
public Employee(String n,int s)
{ name = n;
salary = s;
}
void showEmployee()
{
System.out.print("name: "+name+" ");
System.out.print("salary: "+salary+" ");
}
class Manager extends Employee
{
public String position;
public Manager()
{ position="unknown";
}
public Manager(String n,int s,String p)
{ super(n,s);
position=p;
}
void showManager()
{
System.out.printIn("position: "+position);
}
}
class Demo7_ 2
{
public static void main(String args[])
{
Manager m1=new Manager();
Manager m2=new Manager("Bob",4000,"Sales Manager");
m1.showEmployee();
m1.showManager();
m2.showEmployee();
m2.showManager();
}
}
Transcribed Image Text:package four; public class Employee { public String name; public int salary; public Employee() { name ="Unknown"; salary = 0; } public Employee(String n,int s) { name = n; salary = s; } void showEmployee() { System.out.print("name: "+name+" "); System.out.print("salary: "+salary+" "); } class Manager extends Employee { public String position; public Manager() { position="unknown"; } public Manager(String n,int s,String p) { super(n,s); position=p; } void showManager() { System.out.printIn("position: "+position); } } class Demo7_ 2 { public static void main(String args[]) { Manager m1=new Manager(); Manager m2=new Manager("Bob",4000,"Sales Manager"); m1.showEmployee(); m1.showManager(); m2.showEmployee(); m2.showManager(); } }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Math class and its different methods
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning