Please copy the output and paste it here. Also post what you want it to look like.
Look at the pseudo code in post#18 where I suggested that the reports be printed AFTER the loop had exited.
If...
Type: Posts; User: Norm
Please copy the output and paste it here. Also post what you want it to look like.
Look at the pseudo code in post#18 where I suggested that the reports be printed AFTER the loop had exited.
If...
The newline character output by the println() method will make the next printed String go on the next line. Use the print() method to have the next print out go on the same line.
If the separate tests are related, then they could be tied together. Like even vs odd number: if not even then must be odd.
The comments in the code should say what the code is doing:
//Part D...
Just use one loop that goes from start to end and has inside of the loop the tests, etc
See post#18
Merge the code you have written in post#17 (the if statement for even numbers etc) with that in post#13
See the pseudo code in post#18.
If there is a loop that goes from the first to the last number, there could be more than one section of code in that loop that used the sequence of numbers used in the loop.
begin loop from start...
Parts of the code could be used for that: the loop that goes from one number to the other.
What parts of Part C) are you having problems with? Make a list of the steps needed to do it.
Glad you are making progress. As dicdic said, do it one step at a time.
You can initialize them those variables with those values on the same lines when you define them just like you did with the variable: temp.
The curly braces are very important to organize the code and ensure proper execution.
What values should those two variables have? Where do those values come from? Is the Scanner class object:...
You got part of it. There should be {}s for the loops and if statements
You need to update the code by adding the {}s and indentations to make the code readable.
One problem I see is that statements in the loops and the if statement are not enclosed in {}s. That makes the code harder to read and understand and dangerous to change.
Also nested statements...