Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make a table with the output. THE OUTPUT COLUMNS MUST BE ALIGNED AND NEAT!! Please use printf, , and escape sequences to make the

Please make a table with the output. THE OUTPUT COLUMNS MUST BE ALIGNED AND NEAT!! Please use printf, , and escape sequences to make the output aligned and neat. Thank You! image text in transcribed
Write a complete Java program, including comments, to do the following: Your program will compute the values of a formula that expresses y in terms of x. The formula is: 9x3 - 27x2 - 4x + 12 (3x2 + 1)12 + 5 -x'I where . means "absolute value of and (...) means "square root of". (Use the built-in functions for these operations.) The program should start by printing a message saying this is the output of your first program 2. Then, it should evaluate the formula starting withx--3, going up by 0.5 each time, until x reaches 4. Therefore, it will usc valucs x: -3. -2.5,..., -0.5, 0, 0.5, ..., 3.5,4. For cach value of x, the program should compute the corresponding value of y. 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, then the string 'Y', then the value of y, and then a message. (It is also possible to use column headings instead if you desire.) The message should say one of three things: a) If the value of y is exactly 0, the message should say 'Y IS ZERO b) If the value of y is positive, the message should say Y IS POSITIVE c) If the value of y is negative, the message should say 'Y IS NEGATIVE A typical line of output would then be Y 1.23456 Y IS POSITIVE X-2.5 (in actuality, this may not be the value for y 3. Once you have finished usingx-4, the program should print a message (underneath the last line of output) stating that the program is halting. Then, stop Notes: The output must be sent to a file When printing, use a precision of 1 for the X value and a precision of 3 for the Y value Make sure that your printed source code and printed output is neat! Remember to include comments within your source code Optional: Have your program find which of the y values is closest to 10 (either larger or smaller) have the program print the x value that gives this closest y value. Also, print how close the y value is to 10. Have your program count how many times the formula yields positive, negative, and zero results. Print these three values. Use a table, with appropriate column headings, to neatly display the output Write a complete Java program, including comments, to do the following: Your program will compute the values of a formula that expresses y in terms of x. The formula is: 9x3 - 27x2 - 4x + 12 (3x2 + 1)12 + 5 -x'I where . means "absolute value of and (...) means "square root of". (Use the built-in functions for these operations.) The program should start by printing a message saying this is the output of your first program 2. Then, it should evaluate the formula starting withx--3, going up by 0.5 each time, until x reaches 4. Therefore, it will usc valucs x: -3. -2.5,..., -0.5, 0, 0.5, ..., 3.5,4. For cach value of x, the program should compute the corresponding value of y. 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, then the string 'Y', then the value of y, and then a message. (It is also possible to use column headings instead if you desire.) The message should say one of three things: a) If the value of y is exactly 0, the message should say 'Y IS ZERO b) If the value of y is positive, the message should say Y IS POSITIVE c) If the value of y is negative, the message should say 'Y IS NEGATIVE A typical line of output would then be Y 1.23456 Y IS POSITIVE X-2.5 (in actuality, this may not be the value for y 3. Once you have finished usingx-4, the program should print a message (underneath the last line of output) stating that the program is halting. Then, stop Notes: The output must be sent to a file When printing, use a precision of 1 for the X value and a precision of 3 for the Y value Make sure that your printed source code and printed output is neat! Remember to include comments within your source code Optional: Have your program find which of the y values is closest to 10 (either larger or smaller) have the program print the x value that gives this closest y value. Also, print how close the y value is to 10. Have your program count how many times the formula yields positive, negative, and zero results. Print these three values. Use a table, with appropriate column headings, to neatly display the output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

How do you compute the materials price variance and the quantity?

Answered: 1 week ago

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago