Assignment 13
Due Thursday, November 8 at 9:20am on Canvas



Assignment 13.1: Five More Little Pumpkins (10 pts)
5 little pumpkins
  • Open Pumpkins.java from assignment 11
  • Locate the while loop in the program and convert it to the equivalent for loop
  • If the instructor noted any problems in your original version of the program, please correct them now (getting help where needed)
  • When you are finished, and your output looks like mine, upload your assignment to Canvas.





Your Output Should Look Like the Following. Note that some values have been omitted for brevity.

1
2
3
Five little pumpkins
Sitting on a gate
6
7
Five little pumpkins
9
Sitting on a gate
11
Five little pumpkins
13
14
Sitting on a gate
Five little pumpkins
17
18
19
There are witches in the air!
...
There are witches in the air!
141
142
143
Five little pumpkins
Sitting on a gate
146
147
Five little pumpkins
149
Sitting on a gate


Assignment 13.2: i and j (10 pts)
  • 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