Chapter 9.
Write a program that contains a new class called Film. This class should encapsulate the film title and rating as in the previous chapter.
Remember to include accessor methods to set and get the title and rating.
In the Main section you should ask the user for multiple film titles and ratings and place this data in a Film object. Then write this class to a binary file. Once the user has finished entering films display the contents of the binary file to the console.
using
System; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters.Binary; namespace Films2{ class Class1 {
do {
while (ans != "N");
new BinaryReader(File.Open("Film.dat", FileMode.Open)); film film2 = new film(); BinaryFormatter bm = new BinaryFormatter(); while (br.PeekChar() != -1) {
}
} |