Question: package questions; //Do not import any additional libraries! //-20 penalty applies for each additional import public class Folder { private String folderName; private Bookmark[] bookmarks;

package questions;

//Do not import any additional libraries!

//-20 penalty applies for each additional import

public class Folder {

private String folderName;

private Bookmark[] bookmarks;

public String getFolderName() {

return folderName;

}

public Bookmark[] getBookmarks() {

return bookmarks;

}

/**

* (4 marks)

* @param folderName - The value used to set the object folderName

*

* The function should ensure the following

* - If a null value is given, the 'title' should be set to "New Folder"

* - If an empty string is given, the title should be set to "New Folder"

* - The folderName must start with a capital letter.

* + If the passed folderName starts with a lower case letter, it should be made uppercase

* + If the passed folderName does not start with a letter, the letter "X" should be prepended

*/

public void setFolderName(String folderName) {

//TODO To be completed

}

/**

* (4 marks)

* @param bookmarks - the Bookmark array used to set the instance variable

*

* This function should create a deepcopy of the bookmarks parameter value to the 'bookmarks'

* instance variable. The Bookmark objects held by the array should also be deep copied.

*

* To perform a deep copy you must create a new Array and new Bookmark objects.

*/

public void setBookmarks(Bookmark[] bookmarks) {

//TODO To be completed

}

/**

* (1 marks)

* @param folderName

* @param bookmarks

*

* This constructor must:

* - Use the passed values to set the instance variables

* - Use the setters created above

*

* No marks will be given unless all the setters above are used.

* Full marks will be awarded if the constructor is defined correctly.

*/

public Folder(String folderName, Bookmark[] bookmarks) {

//TODO To be completed

}

/**

* DO NOT MODIFY ANYTHING BELOW!!!

*/

public Folder() {}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!