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 7697577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:02:55+00:00 2026-05-31T22:02:55+00:00

For my homework, we’ve been tasked with creating: Person class with variables firstName, lastName,

  • 0

For my homework, we’ve been tasked with creating:

Person class with variables firstName, lastName, streetAddress, zipCode and phone.

CollegeEmployee extends Person and adds ssn, salary, and deptName.

Faculty extends CollegeEmployee by adding a boolean tenure.

Last but not least, Student extends person by adding GPA and major.

Everything looks good displaying to screen, and I’m moving on to the next part of the assignment which is to create 14 records (7 students, 4 employees and 3 faculty) in an array.

3 different classes, with multiple data types, and I cannot for the life of me figure out how to populate an array with this. This is the first array I’ve created that’s not been completely integer. The Java Tutorials didn’t give me anything, and while Java: Generic Static Multidimensional Arrays has some great information, it’s a little more than I can wrap my head around right now.

I’d initially thought of creating array[14][10] — fourteen variables each for ten objects — but I can’t mix data types. That’s where I got lost.

Anyone have any suggestions on how to design this array and be able to display the values from it afterward?

Any hints and suggestions would be appreciated!

Thanks.

  • 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-05-31T22:02:57+00:00Added an answer on May 31, 2026 at 10:02 pm

    You could also create a Person[] array, just as you would an int[] array. e.g.

    Person[] people = new Person[14]
    

    You can then add people to the Array like this:

    people[0] = new Student();
    people[1] = new CollegeEmployee();
    people[2] = new Faculty();
    

    If you want to check what type of person is in each index you will want to use instanceof. Try looking here for more help

    One example of using instanceof is:

    if(people[0] instanceof Student){
        System.out.println("This person is a student");
    }
    

    Or try using generics.

    You could create an ArrayList<Person> and can then add any type of person to this ArrayList.

    e.g.

    ArrayList<Person> peopleList = new ArrayList<Person>();
    //People can be added like this
    peopleList.add(new Student());
    peopleList.add(new CollegeEmployee();)
    

    Again you are able to use instanceof to check which type of person is in each index!

    Also if you never write

    Person person1 = new Person(); 
    

    In your code then consider making your class abstract.

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

Sidebar

Related Questions

For homework, I'm working with the following three classes. Class | Extends | Variables
For a homework assignment, I was tasked with creating a Ping Pong layer that
For a homework assignment I was given a Card class that has enumerated types
This is homework, and this questions Extends this one So there is a button
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
This is a homework problem that I have. I have been doing some research
I have a homework to classify multi-class images with Support Vector Machines. I am
For my current homework, I'm trying to sort my array through a generic class
Homework: Rock Paper Scissors game. I've created an enumeration: enum Gesture{ROCK,PAPER,SCISSORS}; from which I

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.