Hello I have an assignment for my beginners java course this semester and I'm having some problems with the program I am trying to create. The purpose of the program is to get a starting number, ending number, and an increment from the user to count upwards from the starting number to the ending number. Also it should say if the number printed is negative or positive which I believe I done correctly in my code using the modulus expression. For example the user chooses 3 for start number and 12 for ending number and 3 for the increment the program should print out:
The number 3 is negative
The number 6 is positive
The number 9 is negative
The number 12 is positive
I have some code posted below and It is all kinds of terrible. I was hoping to get a little bit of help.
import java.util.*; public class numbers { static Scanner console = new Scanner(System.in); public static void main(String[] args) { int endNumber; int startNumber; int increment; int count; System.out.print("Your starting number? "); startNumber = console.nextInt(); System.out.print("Your ending number? "); endNumber = console.nextInt(); System.out.print("Your increment number? "); increment = console.nextInt(); System.out.println(); while(count <= endNumber) { if(0 == count%2) { System.out.println("The number " + count + " is positive"); } else { System.out.println("The number " + count + " is negative"); } } System.out.println("Thanks for playing"); } }