I was wondering how to ask the user to input two numbers and show the numbers in between those like a range I guess. For an example I'm suppose to have a high and low variable where you enter two numbers between 1-300 and the user would type in say 15 and 30 and have it print out 15,16,17...to 30. Its suppose to be a program that does conversion with decimals with a bunch of for loops and while loops in it. I feel like I'm starting to get discourage with this stuff and my teacher is knowledgeable with Java but I feel like he's rushing us because he hands out assignments for chapters we haven't covered in class and we won't for another two weeks. thanks
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
By your description, it sounds like you want to print out integers from some value k to another value n.
Use input dialogs or Scanner and System.in to gather inputs. Clip the inputs to the min and max of a desired range.
Next, set the lower value to be the starting value. Then, print out each number until max.
Simple algorithm for getting this done, would be:
There's nothing with pushing you, as there no magic in this assignment. Please google a bit, as this can bea eassily found on SO, and asking answered questions can get you in trouble
The following code will ask for a minimum, maximum, and then print each integer between the two. This might help you get started: