G/radient Specifications: Missing The Missing class is a utility class. In addit
ID: 3754276 • Letter: G
Question
G/radient Specifications: Missing The Missing class is a utility class. In addition to the obvious specifications illustrated in the UML class diagram, the Missing class must satisfy the following specifications. 1. The default double value of a missing value must be 0 . O. 2. The method doubleValue (Double number) must return the double value of the Double parameter unless it is nulï, in which case it must return the default double value of a missing value. 3. The method doubleValue (Double number, double missingValue) must return the double value of the Double parameter unless it is null, in which case it must return missingValue.Explanation / Answer
public class utility {
Double DEFAULT_MISSING_VALUE = 0.0;
public Double doubleValue(Double Number)
{
if(Number != null)
return Number;
else
return DEFAULT_MISSING_VALUE;
}
public Double doubleValue(Double Number,Double missingValue)
{
if(Number != null)
return Number;
else
return doubleValue(missingValue);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.