JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
csHjavaA-2019
about this document
revision
traverse and process
standard algorithms
Parallel Arrays
read text files
write text files
CSV files
Letter frequency
development workflow
indices
More
Share
Explore
read text files
council names
read a file of text values, find max/min values, count occurrences
@
council names
(text values in a text file)
Text Files
One or more lines of text, each separated by a newline (
\n
) :
The key file operations are required:
open
a file
read
from a file
close
a file
Examine the
text file
, it contains the
names
of all 32 Scottish Councils.
Each council name is displayed on a
new line
.
Examine the
code
.
Compare the code with the description in
codeClips
.
Make sure you know what code is used to
open
,
read
and
close
the file.
requirement challenges
What is the
longest
council name?
What is the shortest council name?
How many councils end in the letters
"shire"?
How many councils names start with a
compass direction
?
reuse code for standard algorithms to solve the challenges.
project code
Loading…
avoid looking at the sample code before attempting the project first
sample finished code
The key file operations are demonstrated:
open
a file
read
from a file
close
a file
The
text file
contains the names of all 32 Scottish Councils.
Each council is displayed on a
new line
.
You will know what code is used to
open
,
read
and
close
the file.
Loading…
Text Files
requirement challenges
project code
sample finished code
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.