Modify the definition of the class Species in Listing 5.19 of Chapter 5 by removing the method setSpecies and adding the following methods:
• Five constructors: one for each instance variable, one with three parameters for the three instance variables, and a default constructor. Be sure that each constructor sets all of the instance variables.
• Four methods named set that can reset values: one is the same as the method setSpecies in Listing 5.16, and the other three each reset one of the instance variables.
Then write a test program to test all the methods you have added. Finally, repeat Practice Program 1 in Chapter 5, but be sure to use some constructor other than the default constructor when you define new objects of the class Species.
This project requires the development of test cases that exercise each of the new constructors and methods at least once.
See the code in SpeciesCh6.java, SpeciesCh6Driver.java and YearsToOvertakeCh6.java.
You might also like to view...
A computer consists of various devices referred to as ________ (e.g., the keyboard, screen, mouse, hard disks, memory, DVD drives and processing units).
a. objects b. software c. hardware d. groupware
Which of the following represents how to specify Basic authentication in the .htaccess file?
a. AuthType Basic b. AuthName Basic c. AuthBasicProvider true d. ErrorDocument true
Given the following code, find the compile error.
``` public class Test { public static void main(String[] args) { m(new GraduateStudent()); m(new Student()); m(new Person()); m(new Object()); } public static void m(Student x) { System.out.println(x.toString()); } } class GraduateStudent extends Student { } class Student extends Person { @Override public String toString() { return "Student"; } } class Person extends Object { @Override public String toString() { return "Person"; } }``` a. m(new GraduateStudent()) causes an error b. m(new Student()) causes an error c. m(new Person()) causes an error d. m(new Object()) causes an error
In the body of a style sheet, CSS rule properties are followed by a ________.
a) dot operator b) CSS operator c) colon d) semicolon