Write the name and date of the course and your name, date of birth and signature on the top of each paper. You are allowed to use of the Read (or Lue) class in your solutions. You may also use "S.o.p" as shorthand for "System.out.prinln".
Questions 1 and 4 slightly differ from the Finnish version, because of using different text books.
(6 points)
Implement the gadget as a class MinMax, that has a constructor and the following accessors:
(5 points)
(5 points)
Design a class ProduceP for an implementation of P-factory. There are at least methods for filling the component containers, and a parameterless method for producing P. The producing method produces every time as much P as possible; So every time at least one of the containers becomes empty. The value of the method is the amount of P produced.
Program the class ProduceP. The design process needs not be described, but the program must be commented thoroughly, so that the structure and design desicions become clear to the reader.
Explain shortly how you would test the class.
(5 points)