Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedUsing 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.00 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.00

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

Understand the roles of signs, symbols, and artifacts.

Answered: 1 week ago

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago