CS 132 Notes for the Midterm

CS 132 Notes for the Midterm - CS 132 Notes for the Midterm...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 132 Notes for the Midterm Looping While o Counter controlled (need three things) o Sentinel controlled o Flag controlled o EOF (end of file) Object Oriented Programming Three actions that have to do with a file: 1. Open the file (easy to put into java code) 2. Read the file and see if the word is in it (must be broken down before it can be transferred into java code) a. Need a loop b. Pseudo code option c. Activity diagram 3. Close the file (easy to put into java code) Other things to think about Import statement (you have to know where the file is) Path Stop Word Example ~infile: create a scanner from a file reader ~get the stop word (aWord) ~loop until at end of file ~get the word from the file ~compare strings (aWord and word from file) ~if they are the same return true (can put a return statement so it will self- destruct) ~end of loop ~return false Another method: ~Boolean flag = false ~Loop ~Flag = true ~End loop try {...
View Full Document

Page1 / 4

CS 132 Notes for the Midterm - CS 132 Notes for the Midterm...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online