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
Scottish Council voters
read 2 text files, store as text and integer values, find max, count occurrences, use substring
@
council voters
file values
(number values in a text file)
The key file operations are required:
open
a file
read
from a file
close
a file
Examine the
text file
, it contains the
number of voters
in all 32 Scottish Councils.
Each number 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.
Challenges
Display the name and voters for the largest council (most voters) and the smallest council (least voters)
How many councils are in the Lothians and Edinburgh? How many voters all together?
How many councils are in all of Ayrshire? How many voters all together?
project code
file values
Challenges
project 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.