i have compiled most of the project, I just need to see where i am going wrong with the output of square and squre root.
This project deals with a range-based for loop where we know the exact number of times a loop will iterate (perform the associated block of code). You will also use an if/else construct to determine if work will be done based on the values entered by the user. In addition, we are using the static methods from the Math class, namely pow() and sqrt().
Given:
int x, lowerBound, upperBound;
double square, squareRoot;
Have the user enter a lower bound and an upper bound for a range of integers. If lowerBound is greater than the upperBound, inform the user that no work will be performed otherwise you will construct a for loop to process the range of values from the lower bound to the upper bound, inclusive, incrementing by one each time.
Each time through the loop, using the pow() and sqrt() static Math methods, calculate the square and square root of each value and store the result in the appropriate variable. Display your results. All results involving precision should be to two decimal places using the printf() method of System.out.
Your output should resemble
Your output should resemble:
Please enter a lower bound: 5
Please enter an upper bound: 9
For the value 5 the square is 25.00 and the square root is 2.24.
For the value 6 the square is 36.00 and the square root is 2.45.
For the value 7 the square is 49.00 and the square root is 2.65.
For the value 8 the square is 64.00 and the square root is 2.83.
For the value 9 the square is 81.00 and the square root is 3.00.
Or another run could be:
Please enter a lower bound: 8
Please enter an upper bound: 3
The lower bound is greater than the upper bound.
No work will be performed
Attachments
Tags
Clarifications
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'cramshark'; // required: replace example with your forum shortname
var disqus_identifier = '/production/330';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
Please enable JavaScript to view the comments powered by Disqus.

Attached is the solution to the Java Loop assignment including source and comments. The solution is based upon your existing code.
Attachments
No screenshots uploaded

project4test.java (1 K)
Preview

Screenshots
upper bound
System.out.print("Please enter an upper bound: ");
upperBound = kb.nextInt();
//validate upper > lower
if (lowerBound > upperBound)
System.out.println("The lower bound is greater than the upper bound. No work will be performed. ");
//loop from lower to upper
for(int x=lowerBound;