Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question Goal: Apply ideas about availability and overriding methods Assignment: Imagine that you are a paleontologist that is working on classifying different species of early
Question Goal: Apply ideas about availability and overriding methods Assignment: Imagine that you are a paleontologist that is working on classifying different species of early hominids. While still relatively diverse in their characteristics and abilities, many early hominids already shared some key features, notably, bipedalism. The class Hominid has already been created for you. This class defines the variables locomotion which has the final modifier, and speciesName which is protected. The class also defines the method describe which prints the species name and locomotion. The class constructor assigns the value of speciesName upon instantiation. Create two classes, Australopithicus and Homo Habilis that meet the following requirements: They cannot be inherited. They Define a String variable era. They have a constructor method that: Invokes the contructor method of the Hominid class Initializes the species name to "Australopithecus afarensis" or "Homo habilis". Takes era as an argument and declares it as a class property to be defined by the user. They override the description method by invoking the description method of the Hominid class and then print "This species lived in the era." Base class Hominid class Hominid Final variable, consistent among all hominids public final String locomotion "bipedal"; Protected variable, which might differ between different hominid species protected String speciesName; Constructor for Hominid class public HominidString speciesName this.speciesName speciesName; Protected method to describe the species, can be overridden protected void describe System.out.printlnSpecies: speciesName; System.out.printlnLocomotion locomotion; THE CODE ABOVE IS WHAT I HAVE SO FAR
Question
Goal: Apply ideas about availability and overriding methods
Assignment: Imagine that you are a paleontologist that is working on classifying different species of early hominids. While still relatively diverse in their characteristics and abilities, many early hominids already shared some key features, notably, bipedalism.
The class Hominid has already been created for you. This class defines the variables locomotion which has the final modifier, and speciesName which is protected. The class also defines the method describe which prints the species name and locomotion. The class constructor assigns the value of speciesName upon instantiation.
Create two classes, Australopithicus and Homo Habilis that meet the following requirements:
They cannot be inherited.
They Define a String variable era.
They have a constructor method that:
Invokes the contructor method of the Hominid class
Initializes the species name to "Australopithecus afarensis" or "Homo habilis".
Takes era as an argument and declares it as a class property to be defined by the user.
They override the description method by invoking the description method of the Hominid class and then print "This species lived in the era."
Base class Hominid
class Hominid
Final variable, consistent among all hominids
public final String locomotion "bipedal";
Protected variable, which might differ between different hominid species
protected String speciesName;
Constructor for Hominid class
public HominidString speciesName
this.speciesName speciesName;
Protected method to describe the species, can be overridden
protected void describe
System.out.printlnSpecies: speciesName;
System.out.printlnLocomotion locomotion;
THE CODE ABOVE IS WHAT I HAVE SO FAR
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started