Solved: You are to create a class called zyMethod. It has one constructor, one class method ,and 3 versio…

$30.00

Category:

Description

Solved: You are to create a class called zyMethod. It has one constructor, one class method ,and 3 versio…

You are to create a class called zyMethod. It has one constructor, one class method ,and 3 versions of an instance method called function(). The class should store the double argument passed to in the constructor as an instance variable. For this lab we will call this number, “the value”

all methods should be public.

Constructor

public zyMethod(double dVal)

Methods

boolean threshold()

This should be a class method that returns a boolean value. It returns true if the number of times the constructor has been called is > 5. else it returns false

double function()

Using the pow method of Java’s Math class, function should return “the value” squared.

double function(double exp)

Using the pow method of Java’s Math class, function should return “the value” raised to the exponent exp

double function(double a, double b)

This version of function should return a if “the value” is nearest the input argument a (in absolute value), else it should return b

All methods must be declared public

 


error: Content is protected !!