Purchase Solution

Returning Error Indicators from Methods - Java

Not what you're looking for?

Ask Custom Question

Modify the set methods in class Time2 of Fig. 8.5 to return appropriate error values if an attempt is made to set one of the instance variables hour, minute or second of an object of class Time to an invalid value. [Hint: Use boolean return types on each method.] Write a program that tests these new set methods and outputs error messages when incorrect values are supplied.

Please see attachments for full problem details.

Purchase this Solution

Solution Summary

The solution illustrates how to return error conditions from Java methods using an example (see attachment).

Solution Preview

In order to test if user supplies a wrong value for hour, minute and second three private boolean variables were introduced in ...

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Basic Networking Questions

This quiz consists of some basic networking questions.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Javscript Basics

Quiz on basics of javascript programming language.