

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Quiz Results Statistics Possible: 25 Mean: 16. Std dev: 4. Median: 18 Max: 23 Distribution: <=15: 3, 15 to 19: 6, 20+: 4 Let's look at examples from the last lab Chapter 6: Iteration Last time we looked at the while statement. while (
System.out.println( sum ); NOTE: When might you want a loop to run "forever"? Beware of the same types of errors that occur with if statements: don't put a ; after the boolean expression. Don't forget the {} *Operators +=, -=, =, /=, %= In our programs, we frequently use a variable, add a value to it, and assign the result back into the original variable: valueSum = valueSum + value; money = money * (1 + interest); This is a very common type of expression, so Java provides a shorthand operator for us valueSum += value; money = 1 + interest; // Also /=, -=, %= String s = ""; int j = 0; while ( j < 20 ) { s += ""; j++; } Lab Exercise In genetics, DNA is represented using the symbols A, G, T, and C. Develop a program that asks the user to enter a DNA sequence. Your program should display one of two messages: "That String represents a DNA sequence" "That is not a DNA sequence. The character at position