Problem

a)Modify the two-parameter setHeight method in Figure 7.10 to make it test its units param...

a)Modify the two-parameter setHeight method in Figure 7.10 to make it test its units parameter to see if units is equal to one of the following allowable symbols: “m,” “cm,” “mm,” “in,” or “ft.” If it is equal to one of these, set the instance variables and return true. If it is not equal to one of these, return false.


b)Does this modification require any change to any program that calls the two-argument setHeight method? Why or why not?


c)Write a statement that calls the modified method and utilizes the returned information to print an error message “Error: units not recognized” if the units argument is not one of the allowed values.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 7
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT