Write each answer on a separate paper!
You are allowed to use the tools of the Lue-class (or Read-class) for reading the input. This examination is not a direct translation of the Finnish version: question 3 is slightly different.
(12 points)
Implement the gadget as a class MinMax, which has a constructor and the following accessors:
(12 points)
(12 points)
Model a candidate with the class Candidate, with at least the attributes name (String, non-empty), coalition (int, 1-10), and number of votes (int, 0-). The attributes are implemented as fields in the class public.
Create a program with the help of class Candidate that asks for the data (name, coalition, number of votes) of 903 candidates and checks the accuracy of the data. Then the program computes the comparison figures of the candidates.
Finally, the program outputs the 85 delegates and their 85 substitutes, along with their data, in the order of their comparison figures. Thus, the comparison figures decide who is elected, and in a tie, lots are drawn.
For drawing lots, the following practice may be used.
if (Math.random() < 0.5) // first option else // second option
(14 points)