The germ's genome is a String object. Germs reproduce only by mating. The child gets the genome of one of its parents as such. The likelihood is the same for each parent's genome. The choice of genome can be made with the expression if (Math.random()<0.5) ...
Model the germ as the class Germ, where all the fields are naturally private, and which has the following public tools (constructor and accessor):
Example: (this is exactly how to output: the object's order number belongs to the output, the third output can, of course, be eiter "(3): Mary" or "(3): Mark")
Germ daddy = new Germ("Mark");
Germ mommy = new Germ("Mary");
Germ child = daddy.mate(mommy);
System.out.println(daddy); // output: (1): Mark
System.out.println(mommy); // output: (2): Mary
System.out.println(child); // output: (3): Mary
(12 points)
Example: (this is exactly how to output: the object's order number belongs to the output)
DoubleGerm geezer = new DoubleGerm("Charlie"); // number 1
DoubleGerm biddy = new DoubleGerm("Carrie"); // numero 2
DoubleGerm cub = biddy.mate(geezer);
System.out.println(cub); // output: (3): CarrieCharlie
(12 points)
(15 points)
When the program has created a "dictionary" of words, then it offers the translation service: When the user writes a word in the original language, the program either gives the translation or informs that the asked word was unknown. Design and program self, how the program ends.
If you wish, you are allowed to use (but it is not obligatory!) to use an instance of the class Hashtable<K,V> as the data structure. If you do not use it, you may assume that there are not more than 10000 words in the input file. If you decide to use the Hashtable<K,V>, this part of its API might be useful:
public Hashtable<K,V>() Constructs a new hashtable with the mapping from type K to type V.
(14 points)