COP 3502 Chapter Notes - Chapter 5: Microsoft Dynamics Ax

49 views4 pages

Document Summary

A loop can be used to tell a program to execute statements repeatedly. A while loop executes statements repeatedly while a condition is true. while(loop continuation condition) statement(s); Loop design strategies: identify the statement that needs to be repeated, wrap statement within loop body, code loop condition and add appropriate statements for controlling the loop. Sentinel value-input value that signifies the end of the input. Input redirection-takes inputs from a file instead of inputs from the keyboard (e. g. java. Output redirection-sends outputs to a file instead of displaying it on the console (e. g. java classname > output. txt) A do-while loop is the same as a while loop except that it executes the loop body first and then checks the loop condition status. do statement(s); while(loop continuation condition) The example below rewrites and simplifies sums. java by using a do-while loop instead of a while loop.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents