Write a program in java to evaluate and print the value of the following mathematical function: f(x

Write a program in java to evaluate and print the value of the following mathematical function:
f(x,y) = 2x2 - y + 3

Vary the values of x and y according to the following table and prints the values of f(x,y) as shown in the table.
x = ( 3.0, 2.0, -4.0)
y = (3.0, 3.0, 2.0)

Thanks

Here’s what I’ve tried

public class Example {

public static void main(String[] args) {

    double z;
    double x;
    double y;

    z = 2*x*x - y + 3;

    x = 3.0;
    y = 3.0;

    System.out.println(z);

}

}

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories