Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

So I have a project in compsci but I keep getting an \"illegal start of expressi

ID: 3739537 • Letter: S

Question

So I have a project in compsci but I keep getting an "illegal start of expression" but I cannot find the error, I feel like it's staring right at me but I can't see it. Here's the code in text and in attachments.

1 /This class encapsulates a list of user-defined items that should be done- a "TODO" list. 2Each item on the list is represented by a String object. 3The list is implemented by a String array. The array is initialized in the constructor to an 4initial length that is passed to the constructor. The initial array contains only NULL values 5A user adds an item (a String) to the list by calling the addItem method, passing in a String 6 that represents the to-do item 7Thus, the array may have fewer items (Strings) than its length. For example, assume the list has an initial length of 5. It looks like this: 10 NULL, NULL, NULL, NULL, NULL 12 Then, a user adds three items. It looks like this: 13"eat lunch"walk dog","study Java", NULL, NULL 14 15The length of the list is 5, the number of items is 3.The NULL values are unoccupied cells. 16 The capacity of the array is its length. The size of the data stored in the array is less than 17or equal to its capacity. 18 19If a user wants to add more items to a list that has no more NULL values, i.e. no more room, 20the expandArray method is called to double the length of the toDoList. The original Strings 21 are in the same positions, but the new array has double the capacity- more room for adding items. 22 */ 23 public class TODOList f 24 25 26 27 28 29 30Constructor that initializes the initialLength variable to the value passed in /YOUR Instance variable declarations here./ private String[] TODOList; private int initialLength; private int numItems;

Explanation / Answer

::>> in line 114 the variable name is numLoop instead of numLoops and after numLoop there is a closing curly bracket "}" .. this will remove your illegal start of expression error ..

public void clearToDoList(){

int numLoop = 0;

while(numLoop < TODOList.length && TODOList[numLoop] != null){

TODOList[numLoop] = null;

numItems -= 1;

numLoop++ ;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote