Question:Write a program that gets two numbers from the user, a and b, you may assume that a<b. It then prints the squares of all the numbers in the inclusive range [a, b].
This is the question for my assignment and I am completely lost, I learned some of the concepts but I just don't know how to apply it to this.
my code:
import java.util.*; import javax.swing.*; public class Ch4Q11 { public static void main (String[] args) { int n; int m; int accumulator; final int high = m, low = n; String valuea, valueb; valuea = JOptionPane.showInputDialog("Write first number here: "); n = Integer.parseInt(valuea); int amount = high - low + 1; while (accumulator >= 0) { valueb = JOptionPane.showInputDialog("Write second number here: "); m = Integer.parseInt(valueb); System.out.print(accumulator + " "); System.out.println(Math.sqrt(accumulator) + " " ); n--; } } }
as you can see I'm not even close.. I would really appreciate it if someone could help me with this
Thank you,
Harris