beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Max Double

Geoffrey Challen // 2020.10.0

Define a public class named Max which stores the maximum from a series of provided double values. Max should define a single public constructor that accepts a double that sets the initial value. You should also provide two other instance methods:

  1. add: accepts a single double and updates the maximum if necessary, but does not return a value
  2. max: returns the current maximum value

Once your class works correctly it should behave like this:

Your Max class should not expose any state publicly. You may also not store passed values in an array. This is incorrect and will prevent your class from recording the maximum of a large number of values!