Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Java ONLY, no SQL or anything else. Store all data in a text file. A stock is first offered to the public at a
Using Java ONLY, no SQL or anything else. Store all data in a text file.
A stock is first offered to the public at a start-off stock-price. The initial offering also comes with an initial volume or number of stocks). Every stock is identified by a stock symbol which is a string. Then, the stock market takes over and the stock-price fluctuates with the buying and selling of the stock. Write a Stock class. It should only have a generic constructor, which requires a stock symbol, an initial volume, and an initial stock-price. The methods required for the class are Buy Sell number, new price number, new price decreases the volume by number and sets the stock-price to the new price increases the volume by number and sets the stock-price to the new price Current State Prints the current state of the stock - volume and price, and total value of the stock Write an application (call this class - Broker) that creates and operates on one stock. The symbol, initial volume, and start off price for the stock is obtained from the user. Outputs the Current State of the Stock. Then gives the user an interactive option to buy and sell stocks at different prices. (User can sell no more than has been bought) Output the Current State of the Stock. Ex: User inputs the symbol MYSTK initial volume as 100000, starting price as $ 8.00. Output of Current State: Symbol Volume Price Value MYSTK 100000 S 8.00 $ 800000.00 User selects Buy User selects Buy User selects Buy 1000 5000 6000 $ 8.25 $ 8.50 $ 8.40 User selects Sell 10000 $8.50 Use selects End Output of Current State: Symbol Volume Price Value MYSTK 98000 S 8.50 $ 833000.00Step 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