Long term plan unit: |
School: |
|||||||||||||||||||||||||||||||||||||
Data: |
Teacher’s name: |
|||||||||||||||||||||||||||||||||||||
Class: |
The number of attendees: |
absentees: |
||||||||||||||||||||||||||||||||||||
Lesson theme |
Work with files |
|||||||||||||||||||||||||||||||||||||
Learning objectives that are achieved in this lesson (Subject Programme ref) |
Use of files to read and write information |
|||||||||||||||||||||||||||||||||||||
Lesson objectives |
Use of files to read and write information |
|||||||||||||||||||||||||||||||||||||
Evaluation criteria |
Knowledge · Know how to read from text file · Know how to write to text file
Understanding · Describes the process of reading from text file · Describes the process of writing to text file
Application · Write code for reading from text file · Write code for writing to text file
|
|||||||||||||||||||||||||||||||||||||
Language objectives
|
Student is able to describe the process of reading and writing the information from and to file. For instance, the piece of text is being read out from file. So, text file has to be opened and then … . Also, student can justify the purpose of passing information to and from file Vocabulary and terminology specific to the subject: Text file, pass data, open file for reading, open file for writing Useful expressions for dialogs and letters: Well, the variable of string type is passed to text file for … . For example, reading every line of file is … . Obviously, the text files are used for the wide variety of cases like … .
|
|||||||||||||||||||||||||||||||||||||
Cultivating values
|
collaboration, mutual respect, academic honesty, perseverance, responsibility, lifelong learning |
|||||||||||||||||||||||||||||||||||||
Cross curricular links |
English, Math |
|||||||||||||||||||||||||||||||||||||
Prior knowledge
|
Programming basics, file types |
|||||||||||||||||||||||||||||||||||||
During the classes |
||||||||||||||||||||||||||||||||||||||
Planned stages of the lesson |
Planned activities in the classroom |
Resources |
||||||||||||||||||||||||||||||||||||
Beginning 4 min
|
1. Greetings 2. Starter (C) students guess the topic from images 3. Announcement of topic and LO Students asked to think about Evaluation Criteria(EC) for LO to work it out (official EC is supplied) 3. Vocabulary 4. Useful expressions for dialogs
|
Slides 1-4 |
||||||||||||||||||||||||||||||||||||
Middle
13 min
13 min
8 min |
Task 1 Action: practice Purpose: introducing to reading from text file Description:
Evaluation:
Feedback: Teacher makes comments or correction when necessary
Task 2 Action: write a program Purpose: introducing to writing into text file Description:
Evaluation:
Feedback: Teacher makes comments or correction when necessary
Summary Task 3 Action: write a program Purpose: read from and write to text file Description:
Evaluation:
Differentiation: The students who finish earlier have to develop the program by adding several words to text file. Students must use a loop to append a single word each time. Feedback: Teacher makes comments or correction when necessary
|
Slides 5 Appendix 1 Handout 1
Slide 6 Handout 2
Slide 7 |
||||||||||||||||||||||||||||||||||||
End 2 min |
Learners reflect at the end of the lesson: Where is I am? (Blob tree) |
Slide 8 |
||||||||||||||||||||||||||||||||||||
Differentiation - how do you plan to provide more support? What tasks do you plan to put before more able learners? |
Evaluation - how do you plan to check the level of mastering the material by learners? |
Health
and safety practices |
||||||||||||||||||||||||||||||||||||
Дифференциация может быть выражена в подборе заданий, в ожидаемом результате от конкретного ученика, в оказании индивидуальной поддержки учащемуся, в подборе учебного материала и ресурсов с учетом индивидуальных способностей учащихся (Теория множественного интеллекта по Гарднеру). Дифференциация может быть использована на любом этапе урока с учетом рационального использования времени. |
Use this section to record the methods that you will use to assess what students have learned during the lesson. |
Health-saving technologies. Used body and physical exercises. Points applied from the Safety Rules in this lesson. |
||||||||||||||||||||||||||||||||||||
Reflection on the lesson
Were the goals of lesson/ learning objectives realistic? Have all the students reached the LO? If not, why? Is the differentiation done correctly in the lesson? Were the time stages of the lesson sustained? What were the deviations from the lesson plan and why? |
Use this section to reflect on the lesson. Answer the most important questions about your lesson from the left column. |
|||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
Overall assessment
What two aspects of the lesson went well (think about both teaching and learning)? 1:
2:
What could help improve the lesson (think about both teaching and learning)? 1:
2:
What I found during the lesson related to the class or the achievements / difficulties of individual students, what should I look for in subsequent lessons? |
||||||||||||||||||||||||||||||||||||||
Appendix 1 (handout 1)
How to: Read From a Text File
class ReadFromFile
{
static void Main()
{
// Example #1
// Read the file as one string.
string text = System.IO.File.ReadAllText(@"C:\TestFolder\WriteText.txt");
// Display the file contents to the console. Variable text is a string.
System.Console.WriteLine("Contents of WriteText.txt = {0}", text);
// Example #2
// Read each line of the file into a string array. Each element
// of the array is one line of the file.
string[] lines = System.IO.File.ReadAllLines(@"C:\TestFolder\WriteLines2.txt");
// Display the file contents by using a foreach loop.
System.Console.WriteLine("Contents of WriteLines2.txt = ");
foreach (string line in lines)
{
// Use a tab to indent each line of the file.
Console.WriteLine("\t" + line);
}
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
System.Console.ReadKey();
}
}
The following conditions may cause an exception:
The file doesn't exist or doesn't exist at the specified location. Check the path and the spelling of the file name.
How to: Read a Text File One Line at a Time
This example reads the contents of a text file, one line at a time, into a string using the ReadLine method of the StreamReader class. Each text line is stored into the string line and displayed on the screen.
Example
int counter = 0;
string line;
// Read the file and display it line by line.
System.IO.StreamReader file =
new System.IO.StreamReader(@"c:\test.txt");
while((line = file.ReadLine()) != null)
{
System.Console.WriteLine(line);
counter++;
}
file.Close();
System.Console.WriteLine("There were {0} lines.", counter);
// Suspend the screen.
System.Console.ReadLine();
Compiling the Code
Copy the code and paste it into the Main method of a console application.
Replace "c:\test.txt" with the actual file name.
The following conditions may cause an exception:
The file may not exist.
Handout 2
Write to a Text File
These examples show various ways to write text to a file. The first two examples use static convenience methods on the System.IO.File class to write each element of any IEnumerable<string> and a string to a text file. Example 3 shows how to add text to a file when you have to process each line individually as you write to the file. Examples 1-3 overwrite all existing content in the file, but example 4 shows you how to append text to an existing file.
class WriteTextFile
{
static void Main()
{
// These examples assume a "C:\TestFolder" folder on your machine.
// You can modify the path if necessary.
// Example #1: Write an array of strings to a file.
// Create a string array that consists of three lines.
string[] lines = { "First line", "Second line", "Third line" };
// WriteAllLines creates a file, writes a collection of strings to the file,
// and then closes the file. You do NOT need to call Flush() or Close().
System.IO.File.WriteAllLines(@"C:\TestFolder\WriteLines.txt", lines);
// Example #2: Write one string to a text file.
string text = "A class is the most powerful data type in C#. Like a structure, " +
"a class defines the data and behavior of the data type. ";
// WriteAllText creates a file, writes the specified string to the file,
// and then closes the file. You do NOT need to call Flush() or Close().
System.IO.File.WriteAllText(@"C:\TestFolder\WriteText.txt", text);
// Example #3: Write only some strings in an array to a file.
// The using statement automatically flushes AND CLOSES the stream and calls
// IDisposable.Dispose on the stream object.
// NOTE: do not use FileStream for text files because it writes bytes, but StreamWriter
// encodes the output as text.
using (System.IO.StreamWriter file =
new System.IO.StreamWriter(@"C:\TestFolder\WriteLines2.txt"))
{
foreach (string line in lines)
{
// If the line doesn't contain the word 'Second', write the line to the file.
if (!line.Contains("Second"))
{
file.WriteLine(line);
}
}
}
// Example #4: Append new text to an existing file.
// The using statement automatically flushes AND CLOSES the stream and calls
// IDisposable.Dispose on the stream object.
using (System.IO.StreamWriter file =
new System.IO.StreamWriter(@"C:\TestFolder\WriteLines2.txt", true))
{
file.WriteLine("Fourth line");
}
}
}
Links:
1. https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/file-system/how-to-read-from-a-text-file
2. https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/file-system/how-to-write-to-a-text-file
Скачано с www.znanio.ru
© ООО «Знанио»
С вами с 2009 года.