Back to problems

Message Logger

Object-Oriented Programming · Confluent · Easy

Design a logging utility that enforces a rate limit on repeated messages. The core is a method shouldPrintMessage(timestamp, message) which decides whether a given message should be printed at the provided timestamp. A message is allowed to be printed only if the same message has not been printed during the preceding time seconds. If it has, the method must return false; otherwise, it returns true and records that the message was printed now. Input: timestamp — a…

Checking your access…