Question: Simple Lambda Program ( 2 5 ) Given the following functional interface: interface Powers { double power ( double a , double b ) ;

Simple Lambda Program (25)
Given the following functional interface:
interface Powers
{
double power(double a, double b);
}
Write a simple class LambdaPowers with a main method that implements the interface so that it returns the result of raising he forst variable to the power of the second.
The interface should be implemented two ways. e1 creates a function without a return statement. e2 creates a function with a return statement inside the labda expression. For each case read in the inputs.
Write simple output statements to demonstrate the two functions.
3
Sample input/output:
Please enter two values as type double: 3.04.1
Without return the power is 90.406
Please enter two values as type double: 64.33
With return the power is 3.945

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!