Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy are my getName() and getSalary() causing errors? Should they not be pulling from the other class?
    primarykey
    data
    text
    <p>The only error I have showing up is that the getName() and getSalary() are not found in there class. I am trying to get the information that is entered into the testEmployee class to use use Employee and display the results. I get a Build Successful message but no output. </p> <pre><code>public abstract class Person { // Variables private String name; private String ssn = null; public Person(String name) { this.name = name; } // Pass data to the object Person /** * * @param ssn */ public void setSsn(String ssn) { this.ssn = ssn; } public String getSsn() { return ssn; } /** * * @return */ public abstract String getName(); } class Employee extends Person { // Variables private String jobTitle; private double salary; private String getName; private double cost; public Employee(String name) { super(name); salary = 0; jobTitle = null; } // Pass values to the obljects // Setters public void setJobTitle(String jobTitle) { this.jobTitle = jobTitle; } public void setSalary(double cost) { salary = cost; } // Getters @Override public String getName() { return getName(); } public String getTitle() { return getJobTitle(); } public double getSalary() { return salary; } /** * @return the jobTitle */ public String getJobTitle() { return jobTitle; } /** * @return the getName */ public String getGetName() { return getName; } /** * @param getName * the getName to set */ public void setGetName(String getName) { this.getName = getName; } /** * @return the cost */ public double getCost() { return cost; } /** * @param cost * the cost to set */ public void setCost(double cost) { this.cost = cost; } } public class testEmployee { public static void main(String[] args) { Employee emp1 = new Employee("John Smith"); String ssn = "333224444"; String jobTitle = "Web Designer"; double cost = 60000; System.out.println("Employee " + getName() "\n The current compensation is " + getSalary()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload