Question: 12.2: i and j Create a new Java file called IJ.java. In this assignment, we are going to write another program that uses a for

12.2: i and j

  • Create a new Java file called IJ.java.
  • In this assignment, we are going to write another program that uses a for loop.
  • Within the loop, make the variable i go from -5.0 to 5.0, counting by 0.5
  • Inside the body of the loop, set another variable j to be the current value of i raised to the fourth power.
  • For output, you will need to display the current values of both i and j in a chart, as shown below.
  • Note that above the values, you should print out i above the i column and j above the j column.
  • Also, you should display the values to exactly one decimal point.
  • You will need to use tab (how can you print a tab?), System.out.printf and the Math.pow(base,exp) method.
  • When you are finished, upload your source code to Canvas.

Your Output Should Look Indentical to the Following:

i j -5.0 625.0 -4.5 410.1 -4.0 256.0 -3.5 150.1 -3.0 81.0 -2.5 39.1 -2.0 16.0 -1.5 5.1 -1.0 1.0 -0.5 0.1 0.0 0.0 0.5 0.1 1.0 1.0 1.5 5.1 2.0 16.0 2.5 39.1 3.0 81.0 3.5 150.1 4.0 256.0 4.5 410.1 5.0 625.0

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 Databases Questions!