Question: 8. Programming. Write a static method called stockMarket that takes a console Scanner, prompts the user for a series of stock prices, and reports and

 8. Programming. Write a static method called stockMarket that takes a

8. Programming. Write a static method called stockMarket that takes a console Scanner, prompts the user for a series of stock prices, and reports and returns the greatest price increase seen ase seen for an individual stock. Your method should first prompt for the number of stocks followed by the number of days. Then, for each stock you should consecutively read prices based on the number of days provided. example, below is a sample call on the method: Scanner console = new Scanner(System.in); double priceIncrease = stockMarket (console); This call would produce an interaction like the following user input is in bold and underlined): How many stocks? 3 How many days? 4 Stock 1: 14.1 16.2 12.1 15.0 Stock 2: 53.5 55.0 68.9 51.2 Stock 3: 27.1 23.0 22.0 21.4 Stock 2 had greatest price increase of $13.9 on day 3 The method would also return a value of 13.9. Notice that for each stock 4 prices are read corresponding to each of the 4 days. Also notice the stock, the day and the price change for the greatest price increase are all reported. The 2nd stock is reported to have the greatest price increase on day 3, since the change up to $68.9 occurred on day 3. If there is a tie in the greatest price increase, you should report on the first time this price increase was seen. You may assume the user will always type valid input and provide a positive integer for stocks and an integer greater than or equal to 2 for days. You may also assume at least one price increase will be seen. parameter: Scanner consol

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!