CISC 1115 Assignment 1 Write a complete Java program, including at least one good comment at the top, to do the following: Your program will compute values of a formula that expresses y in terms of x....

How could I program for this assignment?


CISC 1115 Assignment 1 Write a complete Java program, including at least one good comment at the top, to do the following: Your program will compute values of a formula that expresses y in terms of x. The formula is: 4x3 + 8x2 – 31x - 35 y = ------- (3x2 + 1)1/2 + 2 * | x - 1.5 | | | means absolute value; (...)1/2 means square root You should use Math class methods for square root and absolute value. 1. The program should start by printing a message giving your name and saying this is the output of your first program. 2. Then your program should evaluate the formula shown above, starting with x = 3 (negative 3), going up by 0.5 each time until it reaches 3.0. Therefore, your program will use these values for x: 3, 2.5, ..., 0.5, 0, 0.5, 1, ..., 2.0, 2.5, 3.0. For each x value, the program should compute the corresponding y value. It should print these values together with explanations of what the values represent. For example, it could print the string "X = ", then the value of x, the string "Y = ", the value of y, and a message. (It is also possible to use column headings and have your numbers underneath the headings.) The message should say one of three things (on the same line as the values): If the value of y is exactly 0, the message should say Y IS ZERO. If the value is positive, the message should say Y IS POSITIVE. If the value is negative, the message should say Y IS NEGATIVE. A typical line of output would look like this (or the values of x and y can appear underneath column headings): X = 2 Y = 0 Y IS ZERO (actually, this one will not be zero) all on one line Your output does not need to be formatted, but it should be readable. 3. Once you have finished using x = 3.0, the program should print a message (underneath the last line of output) saying that your first program is complete, then stop. These are for extra credit; we haven’t learned how to do them yet 1. Have your program find which of the y values is closest to 0 (either larger or smaller) without actually being equal to 0. Print the x value that gives this closest y value. Also print how close the y value is to 0. 2. Have your program count how many times the formula is positive, how many times it is negative, and how many times it is zero. Print these three values. 3. Use a printf statement to generate a neat listing of output.
Sep 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here