I have 2 classes, Event and Dear. I have created Event class with two variables which are Date and Type of Event. This class is known as the ADT Event class.
Another class Dear, has variables name, hphone, email, type of relation and event(which is supposed to be a stack).
How do I write the proper constructors, set and get and toString methods for the event part(highlighted) in the 'Dear' class?
Is the code below correct?
Code:public Dear(String n, int hp, String e, String t, Stack ev) { setData(n, hp, e, t, ev); } private void setData(String n, int hp, String e, String t, Stack ev) { n = name; hp = hphone; e = email; t = tor; ev = event; }Code:public Stack getEvent(){ return event; }Code:public String toString() { return name + "\t" + hphone + "\t" + email + "\t" + tor "\t" + event; }




Reply With Quote