package project;
import java.util.Scanner;
public class Game {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int first = 1;
int last = 10;
int...
Type: Posts; User: Norm
package project;
import java.util.Scanner;
public class Game {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int first = 1;
int last = 10;
int...
The code you have posted shows some of the statements you will need. Trying to write the whole program at once will make for confusion. Doing it one step at a time will be a better approach.
Are...
I suggested that you work on the problem, one small step at a time. You seem to have ignored my suggestion and are trying to write the whole program at once.
Try writing the code for the small...
Copy the statement(s) that you don't understand and ask a question about it.
In this statement:
last = 25;
25 is a hardcoded value. last's value should be computed based on the previous values...
Please edit your post and wrap your code with code tags:
YOUR CODE HERE
to get highlighting and preserve formatting.
The code should set the values of the variables with hardcoded...
That is NOT the code I was talking about. Try again. Write code that only does the simple first step as discussed in posts #8 and #4. Make a complete class, that will compile and execute. Do it:...
That's probably right. Now try writing the simple one step program I suggested:
set initial values
ask question
move markers as per user's response
print out new value of markers
Please post the code you are talking about.
If the response is not less that means greater. Change the bottom/left to the middle.
Have you tried the visual exercise I suggested?
Try doing the program in a series of small steps:
First step:
Change your current code to use variables as I suggested. Ask the question using the variable.
Change the variables to new values...
Use variables vs hardcoding numbers:
"is your number greater than 50? yes/no");
Replace the 50 with a variable that starts at 50 and then is computed as the game goes on.
Something like...