Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java Program that calculates the maximum profit: Hint:~ Answer should be 183.86, You can use this Code from here https://pastebin.com/k0qMqPRw but Modify it

Write a Java Program that calculates the maximum profit:

Hint:~ Answer should be 183.86, You can use this Code from here https://pastebin.com/k0qMqPRw but Modify it so it displays the Max Profit bc in its current state it outputs/prints the maximum loss. We need to find out the Maximum Profit

CSV File Link - https://www.dropbox.com/s/tpyvapym5t8xx80/Data.csv?dl=0

Please paste the code below as the answer to the problem with a screenshot of the output to prove it worked..

image text in transcribed

Problem The stock market generates a massive amount of data each day, so much so that computerized methods are required to manage the volume. You are asked to write a program that uses real data to evaluate a stock. Requirements Write a Java program that will read and analyze the provided real stock price data and determine the maximum profit possible based on buying at a low price and selling at a high price. The program will read data from a file called "Data csv" to retrieve the date and value per share (adicose). The only columns of interest in this comma separated value file are the first and the last columns: the "Date" column and the "Adi Close" column respectively We can find the profit per share by searching through the closing share values and finding the largest positive difference between a pair of values. Obviously, the shares must be bought before they can be sold. The profit realized between any two days is computed as the difference between the later share value and the earlier share value. You will note that the file is arranged by date starting with the latest values and going back in time. output You are required to output only the buy and sell dates and the profit per share that could have been realized for making the best possible trade

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions