

Using Text Files
Presentation
•
Computers
•
9th - 12th Grade
•
Practice Problem
•
Easy
Katherine Valenti
Used 1+ times
FREE Resource
86 Slides • 5 Questions
1
Using Text Files
2
Students will be able to...
Read data from external text files using Java’s File and Scanner classes
Store and analyze file data using arrays and string methods
Use try-catch blocks to handle IOException errors gracefully
Parse data using split() and apply algorithms to extract insights
Read, convert, and analyze numerical data from files
3
Warm Up
4
Open Ended
Why might a program need to read information from a file instead of asking the user to type everything
5
Warm Up
Handle larger data
Save time
Be reused across sessions
6
Open Ended
What do you expect could go wrong when trying to read a file?
7
Warm Up
File might not exist
Might be in the wrong place
Might have formatting issues
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Try-Catch with IO Exception
Another way to terminate if an error occurs is to use a try-catch block
More graceful
Display a more informative message
55
Try-Catch with IO Exception
Try Block: write the code to access and manipulate the file data
Catch Block: explains what to do if a specific error occurs
56
Try-Catch with IO Exception
Catch condition: in parentheses, specify the type of error you want to catch
Files- IOException error with variable e, which contains info about the exception
57
Try-Catch with IO Exception
e.getMessage()- returns a human-readable description of the error
Can use in a print statement to inform the user of the error
58
Now It's Your Turn
Head to CodeHS and access the Using Text Files modules. You will be completing:
Read in a Haiku
Karaoke
Exploration: Reading Files and Arrays
Best Men's Soccer Players: Reading Files and Arrays
Exploration: Split Method
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Now It's Your Turn!
Head to CodeHS and access the Using Text Files (Day 2) modules. You will be completing:
Exploration: Number of Active Days
FitBit: Read in Sleep Data
FitBit: Analyze Sleep Data
86
Wrap Up
87
Match
Match the following concepts:
Process of reading information from and writing information to files
Error related to file access or reading
Java construct to gracefully handle runtime errors
Method that divides a string based on a delimeter
Extracting and converting data from Strings
File I/O (File Input/Output)
IOException
try-catch
Split Method
Parsing
File I/O (File Input/Output)
IOException
try-catch
Split Method
Parsing
88
Open Ended
What is the purpose of a try-catch block when working with files?
89
Wrap Up
Prevent the program from crashing
Provide error messages if the file can't be opened
90
Open Ended
How does using an array help when working with data from a file?
91
Wrap Up
Stores all entries for later use in one location
Helps in filtering, searching, or averaging
Using Text Files
Show answer
Auto Play
Slide 1 / 91
SLIDE
Similar Resources on Wayground
91 questions
Present Simple and Present Continuous
Lesson
•
10th - 12th Grade
83 questions
2.2.2 Computational methods - SLR24
Lesson
•
KG - University
87 questions
Asexual Reproduction in Animals
Lesson
•
9th - 12th Grade
88 questions
Introduction to Aviation
Lesson
•
9th - 12th Grade
85 questions
Module 7: Nursing Skills
Lesson
•
KG - University
82 questions
Skeletal System Review
Lesson
•
9th - 12th Grade
79 questions
Graphic Design: Workplace Technologies
Lesson
•
9th - 12th Grade
91 questions
WHI 7.01 and 7.02 Rise of the Monarchs
Lesson
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
14 questions
Boundaries & Healthy Relationships
Lesson
•
6th - 8th Grade
13 questions
SMS Cafeteria Expectations Quiz
Quiz
•
6th - 8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
SMS Restroom Expectations Quiz
Quiz
•
6th - 8th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
10 questions
Pi Day Trivia!
Quiz
•
6th - 9th Grade
Discover more resources for Computers
10 questions
Pi Day Trivia!
Quiz
•
6th - 9th Grade
15 questions
Pi Day Trivia!
Quiz
•
9th Grade
15 questions
Pi Day Trivia
Quiz
•
9th - 12th Grade
10 questions
Understanding Pi and Its Applications
Interactive video
•
7th - 12th Grade
10 questions
Cell Organelles and Their Functions
Interactive video
•
6th - 10th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
5 questions
Did You Know? Ireland
Interactive video
•
9th - 10th Grade
10 questions
Exploring Basic Probability Concepts
Interactive video
•
6th - 10th Grade