I am being asked to complete a method called product that calculates and returns the product of two parameter values. I am currently very lost and have no idea what to do. The question looks like this.
Complete the method below called product that calculates and returns the product of two parameter values.
public static double product (double n1, double n2)
{
int p = 0;
return p;
}
Do you understand how a function works? Do you understand how to pass in values to a function? Do you understand what it means to calculate a product? Do you understand how to return a value from a function?
We need a sense of just how lost you really are.
I’m extremely lost if i’m being honest, its been over a month since i’ve done any programming for my computer programming class due to quarantine and this is my first assignment for this class in over a month, i have always scraped by in this class with low seventies, but yeah i’m extremely lost
Forget about the static public
part for a moment. Do you understand
double product (double n1, double n2)
Don’t just say ‘no’, give it your best shot.
no not really, are those supposed to be the 2 products i am to calculate and return?
and i know what a double is
Correct, n1 and n2 are the two values being passed into the function that you will find the product for. Do you know how to do that? Do you know how to return the value of their product?
I do not know how to pass it into the function nor do i know how to return it.
I think maybe you need to do some reading up on how functions work.
https://www.tutorialspoint.com/java/java_methods.htm