Question
// TO DO: add your implementation and JavaDocs. //These are all the imports you are allowed, don't add any more! import java.util.Scanner; import java.io.File; import
// TO DO: add your implementation and JavaDocs. //These are all the imports you are allowed, don't add any more! import java.util.Scanner; import java.io.File; import java.io.IOException; import java.util.Iterator;
public class StockMonitor {
// NO ADDITIONAL CLASS/INSTANCE MEMBERS SHOULD BE ADDED // YOU CAN ADDITIONAL PRIVATE HELPER METHODS
public ThreeTenDLList
//default return, remove or updated as needed return null; }
public int stepProcess(int day, int price) { //perform one step of span measurement: // - determine and return the span of the given day and price using recordStack // - additional updates to perform: // - add the measured span to the back of spanList // - add the pair of
//default return, remove or updated as needed return -1;
}
public int reportMaxSpan(int price){ // Use priceMap to find out and return the current max span for the given price // if price is not present in priceMap, return 0 // O(1) if hashMap searching is O(1) //default return, remove or updated as needed return -1; } public String spanRecordToString(){ // return a string to report the max span of each price in priceList // - only report each price once // - follow the same order as the first occurence of each price // - each price report should use the same format of "price:maxSpan" // - a single space should be padded between price reports // - no leading or trailing whitespaces in the return string // - return an empty string if priceList is empty // O(n) where n is the length of price list // - assume hashMap updating and searching is O(1) // //default return, remove or updated as needed return null; }
public static void testMain() { //edit this as much as you want, if you use main without any arguments, //this is the method that will be run instead of the program System.out.println("You need to put test code in testMain() to run StockMonitor with no parameters."); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started