You are to design a class College that contains an ArrayList of students. For si
ID: 3660313 • Letter: Y
Question
You are to design a class College that contains an ArrayList of students. For simplicity, the students are represented by their String name. College has a method to add a student to the College. It also has a method that returns a String with the names of all the students - one to a line: You are to complete this class by adding your code in the places marked with // your code here. Upload it along with the tester import java.util.ArrayList; import java.util.Collections; public class College { ArrayList name; public static final String JOEPROGRAMMER = "Joe Programmer"; public static final String JANEAUSTINE ="Jane Austin"; public static final String HARRYPOTTER = "Harry Potter"; public static final String HAMLET= "Hamelt"; // your code here /** * Constructor for objects of class College */ public College () { ArrayList college = new ArrayList(); } /** * adds a student to this College * @param student the name of the student to add */ public void addName(String studentName) { name.add(studentName); } /** * Gets a string representation of this College * @return a string conaining all the students in this College in this form College[ student1 student2 ] */ public String toString(); { String list = "College[ "; System.out.println(college.toString()); return list; } } here is the tester public class CollegeTester { public static void main(String[] args) { College college = new College(); college.add("Joe Programmer"); college.add("Jane Austin"); college.add("Harry Potter"); college.add("Hamlet"); System.out.println(college.toString()); } }Explanation / Answer
your code is so messy, how could i help if i can not read it??
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.