Lab 3 En

1. A Good Example of Liskov Substitution Principle is available here

2. Write the preconditions and postconditions of the next method that reads the content of a file

class Utils {

	public static Collection<String> readFromFile(String absoluteFilePath)

}

Implement the method and call it inside a main method for File1.txt and File2.txt.

3. Considering a Base class, a Derived class that is derived from Base and the next methods, you have to specify whether or not the Liskov substitution principle is violated. Justify your answer by relating the pre and post conditions of the Derived class to the ones from the Base class.

int Base :: g (int x) // PRECOND: x > 100 // POSTCOND: returns a perfect square number

int Derived :: g (int x) // PRECOND: x is int // POSTCOND: returns an even number