|
Learning objectives:After completing this project, you should be able to:
Items in red are learning objectives for this part of the project. |
Group work
| SelectionAndIteration report
| Time limit
|
SelectionAndIteration
project and your SelectionAndIterationReport.txt
file. Add a heading to your report to indicate the beginning of Part 2.JOptionPane
for all required input and output (I/O) in this project (you are free to use whatever method you prefer for other I/O)..showConfirmDialog()
method to ask the user whether or not they would like to use the program. Use the YES_NO_OPTION
optionType. The return value should be either YES_OPTION
or NO_OPTION
. Read the JDK Help for more details. showConfirmDialog()
method? if
statement so that the user's input determines whether or not the rest of the program is executed. Make sure that the program exits gracefully regardless of the user's input. if
statement go with respect to the System.exit( 0 );
statement?if
statement into a while
statement, and add another showConfirmDialog()
call at the bottom of the loop that asks the user whether or not to run the program again. The syntax for a while
statement is:
while( condition ) { statement block }
showConfirmDialog()
call in the same variable as the value returned from the first showConfirmDialog()
call. 1
.while
loop with a break
statement that ensures that the value of c is small enough that the roots will be real. Modify the prompt for the coefficient c so that informs the user of the criterion, and add an appropriate dialog window that informs the user when the input does not meet the criterion.while (false) { statement block }
execute? b = -4 , c = 3
b = -4 , c = 4
b = -4 , c = 8
for
statement is:
for( initialization expression; condition; increment expression ) { statement block }
SelectionAndIteration2
.while
statements.do-while
statements.for
statements.