CECS 478 Study Guide - Midterm Guide: Data Validation

116 views4 pages

Document Summary

Executes instructions until the conditions are no longer valid while (condition) statements. Variables are created outside the loop and updated within the loop. Executes instructions a certain amount of times (count-controlled) for (initialization; condition; update) statements. Initialization is the value the variable will start with. Condition instructs how long the program will run. Update restarts the variable with a different value. Statements carry out the calculation for another variable. Example: for (int i = 5; i <=10; i++) sum = sum + i; Executes the body of a loop at least once and performs the loop test after the body is executed do statements while (condition); Condition is tested after completing the loop body. Used for input validation: int value; do. System. out. print( enter an integer < 100: ); value = in. nextint(); while (value>= 100); Sentinal values are entered by the user and terminate the program.

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

Related Documents