So I have been trying to tackle this problem for a while. Many things I have attempted have failed. Is there a way to add to what I already have?
for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {
int check;
int x, y;
// Prompt as follows
System.out.print("Enter value " + ii + ": ");
try {
c = Get();
}
catch (InputMismatchException e) {
input
System.out.println("Invalid input!");
ii--;
}check = c;
x = check; // I want to try to copy this
y = check - 1; // and copy this
min(x , y) // trying to acheive this
System.out.println(check + " " + x + " " + y);
}
Sorry about the formatting. It is my screen.
Basically let us say user puts in 25 for first input. I want x = 25.
Then user inputs -11. I want y = -11.
Compare minimum z = -11.
then x = z = -11;
User input 33. y = 33
annd so on..
So i ended up with something like
for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {
int check;
int x = 0, y = 0, z;
// Prompt as follows
System.out.print("Enter value " + ii + ": ");
try {
c = Get();
}
catch (InputMismatchException e) {
System.out.println("Invalid input!");
ii--;
}check = c;
x = check;
z = x;
if (j % 2 == 1)
{
y = check;
Math.min(z, y);
}
System.out.println(check + " " + x + " " + y + " " + z);
}
I guess you are trying to get the minimum value from the current input and last minimum value. Definitely it will be the minimum of all the numbers provided.
Then all you need is to save minimum value from the last turn and compare it with input in the next one.
hope I have understood your problem correct.