Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7727629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:30:24+00:00 2026-06-01T05:30:24+00:00

For homework, I’m working with the following three classes. Class | Extends | Variables

  • 0

For homework, I’m working with the following three classes.

 Class           | Extends         | Variables
 --------------------------------------------------------
 Person          | None            | firstName, lastName, streetAddress, zipCode, phone
 CollegeEmployee | Person          | ssn, salary,deptName
 Faculty         | CollegeEmployee | tenure(boolean)

I am having trouble getting the Faculty constructor to properly use the data in the superclasses.

 import java.util.*;
 import javax.swing.*;
 public class Faculty extends CollegeEmployee
 {
      protected String booleanFlag;
      protected boolean tenured;  
      public Faculty(String firstName, String lastName, String streetAddress, 
                     String zipCode, String phoneNumber, String ssn,
                     String department, double salary)
      {
           super(firstName,lastName,streetAddress,zipCode,phoneNumber,  
                 department,ssn,salary);
           String booleanFlag = JOptionPane.showInputDialog(null, "Tenured (Y/N)?");
           if(booleanFlag.equals("Y"))
              tenured = true;
           else
              tenured = false;
      }
      public void setTenure(boolean tenured)
      {  this.tenured = tenured;   }
      public boolean getTenured()
      {  return tenured;  }
      public void display()
      {
          super.display();
          JOptionPane.showMessageDialog(null, "Tenured: " + tenured);
      }
 }

The CollegeEmployee class, from which Faculty descends, appears below.

 import java.util.*;
 import javax.swing.*;
 public class CollegeEmployee extends Person
 {
     protected String ssn;
     protected String sal;
     protected double annSalary;
     protected String department;
     public CollegeEmployee(String firstName, String lastName, 
                            String streetAddress, String zipCode, 
                            String phoneNumber)
     {
         super(firstName,lastName,streetAddress,zipCode,phoneNumber);
           ssn = JOptionPane.showInputDialog(null, "Enter SSN ");
          department = JOptionPane.showInputDialog(null, "Enter department: ");
          sal = JOptionPane.showInputDialog(null, "Enter salary: ");
          annSalary = Double.parseDouble(sal);
     }  
     public void setFirstName(String firstName)
 {  this.firstName = firstName;  }
 public String getFirstName()
 {  return firstName;  }
     ... ETC ...  REMAINING GET/SET METHODS ELIMINATED FOR BREVITY.

The errors I’m getting point to a mismatch between parameters…Faculty calls eight parameters, but CollegeEmployee only has five. However, I’d think that by extending CollegeEmployee which extends Person, I’d have access to all eight fields by the time this class is called. As it’s been pointed out, that’s not the case. I only have the five fields from Person. So my obvious next question is how I get ssn, department and salary from CollegeEmployee to Faculty? That’s the piece I’m missing. I’ve been poring over the Java Tutorials and experimenting for a couple hours, but still can’t get what I need to do for the correction. Do I need to call the People variables, via CollegeEmployee, then instantiate the CollegeEmployee variables in Faculty? I’m getting really confused about what to do and desperately need some guidance…

Thanks loads, I’ll be back in a few after I peruse the super() keywords section in the Tutorials.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:30:25+00:00Added an answer on June 1, 2026 at 5:30 am

    In Faculty.java you have:
    super(firstName,lastName,streetAddress,zipCode,phoneNumber,department,ssn,salary);

    This is physically calling the constructor of CollegeEmployee which has only five parameters. This is a compilation error.

    A class may have variables that are not set in the constructor. You could have empty constructors and set the variables in another method.

    Since there is an inheritance structure, you may only set the parent’s variables via super().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is homework, and this questions Extends this one So there is a button
This is homework. Beginning Java class. Still wrapping my head around this stuff. The
I am doing a homework assignment that deals with classes and objects. In it,
newbie doing Java homework here. I have one class named Album which contains the
My homework assignment is telling me to declare a class inline, but I've only
I have a homework to classify multi-class images with Support Vector Machines. I am
For homework, I was given the following 8 code fragments to analyze and give
For my current homework, I'm trying to sort my array through a generic class
I got this homework. And have solved it in following way. I need your
I have the following homework question: Consider the following declarations and answer the question.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.