Repeat Programming Project 2 in Chapter 5. This time, add the following four constructor methods: one for each instance variable, one with two parameters for the two instance variables, and a default constructor. Be sure that each constructor sets all of the instance variables. Write a driver program to test each of the methods, including each of the four constructors and at least one true and one false case for each of the test methods.

The solution to this project sets the name parameter to “No name” and age to 0 if they are not specified in the constructor. In addition, if the age argument is a negative number an error message is printed and the age is set to 0.


See the code in PersonCh6.java and PersonCh6Test.java.

Computer Science & Information Technology

You might also like to view...

List each line in /etc/services that contains the word send. Precede each line by its line number in the file.

What will be an ideal response?

Computer Science & Information Technology

The and properties limit the values users can select in the Numer- icUpDown control.

a) Maximum, Minimum b) Top, Bottom c) High, Low d) Max, Min

Computer Science & Information Technology

The plus signs at the beginning of rows 2 and 3 indicate that the resource is expanded.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The first step in filtering using advanced criteria is to create a(n) ________ on your worksheet where you define the criteria for the filter

Fill in the blank(s) with correct word

Computer Science & Information Technology