Question
Create Java program that will ask the user for a starting number, an ending number, and an increment number. The program will then count upward,
Create Java program that will ask the user for a starting number, an ending number, and an increment number. The program will then count upward, from the starting number up to and including the ending number, by the increment number, displaying each number on a separate line. Also, for each displayed number, the program will say whether the number is even or odd. This program will require the use of a loop as well as the "if/else" statement. Examine the sample outputs carefully in order to structure your code in a logical manner.
Your program must include the below methods:
getStartNum( ) //returns an int
getEndNum( ) //returns an int
getIncrNum( ) //returns an int
calculateOddEven( ) //returns a string and excepts 3 parameters from getStartNum(), getEndNum() and getIncrNum() ***There should be no print statements in this method.
Issue your method calls from main and print the results in main.
Here is a sample run of the program: Please enter a starting number: 3
Please enter an ending number: 19
Please enter an increment number: 3
The number 3 is odd
The number 6 is even
The number 9 is odd
The number 12 is even
The number 15 is odd
The number 18 is even
Thanks for playing!
Here is another sample run: Please enter a starting number: 5
Please enter an ending number: 30
Please enter an increment number: 4
The number 5 is odd
The number 9 is odd
The number 13 is odd
The number 17 is odd
The number 21 is odd
The number 25 is odd
The number 29 is odd
Thanks for playing!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started