Question: /** * * @return the longest sequence of consecutive trades where stock lost value * return null if stock never lost value on any given

/**

*

* @return the longest sequence of consecutive trades where stock lost value

* return null if stock never lost value on any given day

*/

public ArrayList getLongestLossStreak() {

return null; //to be completed

}

/**

*

* @param d1

* @param d2

* @return the percentage change in stock between the adjusted closing prices two dates, as a Double object

* return null if d1 is later than d2

*

* if d1 doesn't exist in the list, but there are dates before AND after it in the list, use the last date before it.

* if d2 doesn't exist in the list, but there are dates before AND after it in the list, use the last date before it.

*

* if d1 doesn't exist in the list and either a date before OR a date after it is not in the list, return null.

* if d2 doesn't exist in the list and either a date before OR a date after it is not in the list, return null.

*/

public Double getPercentageChangeByDateRange(Date d1, Date d2) {

if (d1.compareTo(d2) == 1) {

return null;

}

for (int i = 0; i < data.size(); i++) {

if (d1.equals(data.get(i).date) == false){

}

}

return null; //to be completed

}

/**

*

* @return a list of list of DailyTrade objects that holds all trades from a given month in a sublist.

* Note that -

* a. the sublists should be in chronological order

* b. the trades within the sublists should be in chronological order

* c. entries for different months should (obviously) be in separate sub-lists

* d. entries of the same month but different years should be separate sub-lists

*/

public ArrayList> getMonthlyTrades() {

return null; //to be completed

}

}

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 Programming Questions!