% Assignment 2 % Raffi Khatchadourian % September 22, 2020 1. During lecture, we simulated a `FileLogger` trait using `println()`, which, obviously, does not input into a file. Implement a real Scala trait---based on our lecture---that logs to a file. 1. During lecture, we discussed an object-level mix-in that logs both to a file and to the console: ```scala val acct3 = new SavingsAccount with ConsoleLogger with FileLogger ``` 1. Where does the log go to first, the file or the console? Why? 1. How would you reverse the order? 1. Add a time stamp to both logs using a `TimestampLogger` trait. 1. Does it matter where you put `TimestampLogger` in the list of traits? 1. What happens if you place `TimestampLogger` *between* `ConsolLogger` and `FileLogger`? 1. Consider the following Scala code: ```scala var acct: SavingsAccount = new SavingsAccount val acct2: SavingsAccount = new SavingsAccount with FileLogger ``` 1. What is the relationship between the run-time types of the objects referred to by `acct` and `acct2`? Explain this relationship. 1. Can `acct2` refer to the object referred by `acct`? Why or why not? 1. Can `acct` refer to the object referred by `acct2`? Why or why not? 1. Explain the difference between the `eq` and `equals` methods. 1. We discussed that application programmers should always use `==` instead of `eq` or `equals`. Can you think of a scenario where this is not true? Explain the use case.