Question: java (b) Write a singleton class called Register, that keeps a record of the names of people registered on a system. Persons are only allowed

(b) Write a singleton class called Register, that keeps a record of the names of people registered on a system. Persons are only allowed to register once and all names should be managed by a single resource. An outline of the code is given. Complete the constructor and methods getRegister and register. class Register private static Register reg = null; private String data; private int size: private Register({ // Complete constructor code } public static Register getRegister({ // complete getRegister code } public boolean register(String name){ // complete register code } public int size({return size;} public Object clone throws CloneNotSupportedException{ throw new CloneNotSupportedException(); } private boolean search(String n){ boolean found = false; for(int j = 0; j
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
