![]() |
.. (לתיקייה המכילה) | |
What is "deleteSquares" in ApartementTest.cpp? | |
The function was erased by mistake. An updated ApartementTest.cpp is on T2 |
How accurate do we need to be when comparing the two ratios price/totalArea? | |
Whenever possible, it is best to avoid floating point comparisons due to numerical issues. You can avoid working with floating points altogether in this comparison and just using integer comparisons. Think about how you do this. |
In price/totalArea ratio, what do we do if totalArea=0? | |
You should handle this case. Use the following rule: apt1 < apt2 if equivelent to - (apt1_price * apt2_area == apt2_price * apt1_area) ? apt1_price<apt2_price : apt1_price * apt2_area < apt2_price * apt1_area |
What should be the price of a new apartment when summing two apartments? | |
The sum of the prices |
What does it mean that "squares" might not be valid after the call to the constructor? | |
It means that you should copy the content of squares and not just the pointer. |
Should we test validity of the content of squares? | |
No. Just check if it is NULL. |
Can we add a default constructor to Apartment? | |
No, you cannot. |
Can I assume T in SortedSet has a default constructor? | |
No. If you want to implement using an array, use an array of pointers and dynamic allocations (don't forget to release the memory) |
If both dimensions of apartments to add are the same, what do we do? | |
Use the first rule in the exercise (rule 'a') |
What do we do if a publisher is trying to unpublish a topic that he had not published, or one that he already unpublished? | |
throw NonPublishedTopic. In the symmetric case where a subscriber is trying to unsubscribe a topic which he is not subscribed to, throw NonSubscribedTopic. Both of these exceptions are defined in Client.h |
What exceptions do we need to throw in part 3 and when? | |
NonPublishedTopic - when a publisher tries to sendMessage to a topic that he had not yet published (with publishTopic), or when a publisher tries to unpublishTopic which he is not currently publishing (already unpublished it or didn't publish it yet) NonSubscribedTopic - the symmetric case of "NonPublishedTopic" for subscribers (receiveMessage instead of sendMessage etc...) IllegalPriority - when a new client is created with negative priority |
Can we change the constructor of client and its descendants to accept Broker& instead of BrokerIfc& ? | |
No, you may not. You should be able to solve this part using only the interface of BrokerIfc (you might need to keep the topic collection in both broker and clients). Furthermore - you may not use dynamic_cast to down-cast to Broker from BrokerIfc |
Do you need to implement &=, |-, ^=? | |
No. |
Can a subscriber subscribe to a topic which has not been published by anyone? | |
Yes. After some publisher does publish that topic and send a message to it, the subscriber who previously subscribed to that topic should get the message |
Can multiple publisher publish the same topic. | |
Yes. Both the publishers and the subscribers are unaware of the topic which are in the system, and should only care about what they published/subscribed to |