Questions 2 and 3 differ from the Finnish version, because of using different text books!
The class has the accessors:
Implement the class ChristmasPuddingbasin as a subclass of the class Puddingbasin. The class ChristmasPuddingbasin has one constructor:
The class ChristmasPuddingbasin has its own accessors:
Note! The class Puddingbasin is at your disposal, you do not need to program it!
(17 pistettä)
(19 points)
The lines are read wit the method
public String read()
When the file ends, the method returns the value null.
The class takes care of all the possible exeptions. When an error occurs, the class gives an error message and exits the program.
By using this class, write a program AreTheFilesSimiliar for comparing two files. The names of the files are given to the program as command-line arguments. The program compares the two files line by line, and prints all different lines to the screen. An example of the output:
1>cat is walking< 2>rat is walking< 1>1235123< 2>1234123< 1>abc< 2>abc < 2> the second< 2>was < 2>longer!<Thus the lines differing from each other are printed between either characters "1>" and "<" or "2>" and "<", depending on where the line in question comes from: from the first file or from the second file. If either file ends before the other, the extra lines of the longer file are printed. The program does not print anything else.
In the example above the files had three different lines and the second file seems to have been three lines longer than the first.
The program doesn't have to take care of the exceptions, the class InpFile takes care of them.
(17 points)