Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ format! Mr. N. Vestor owns several different stocks. Data regarding these stocks can be found in a plain text file. Write a program that

C++ format!

Mr. N. Vestor owns several different stocks. Data regarding these stocks can be found in a plain text file. Write a program that will read specific information from the file and display that information to the screen.

The file contains the following information:\

AMZN~Amazon.Com Inc~1402.05~+24.10~+1.75%~4854900~6806813~01/26/18~1523 AAPL~Apple Inc~171.51~+0.40~+0.23%~39128000~6710843~01/26/18~1224 BABA~Alibaba Group Holding Ltd~205.22~+6.89~+3.47%~23757801~4875576~01/26/18~100 INTC~Intel Corp~50.08~+4.78~+10.55%~86903102~4352107~01/26/18~2213 VMW~Vmware Inc~150.00~+12.37~+8.99%~27806600~4170990~01/26/18~1745 WYNN~Wynn Resorts Ltd~180.29~-20.31~-10.12%~22140102~3991639~01/26/18~500 FB~Facebook Inc~190.00~+2.52~+1.34%~17745000~3371550~01/26/18~750 NVDA~Nvidia Corp~243.33~+6.98~+2.95%~12902001~3139444~01/26/18~1195 NFLX~Netflix Inc~274.60~+4.90~+1.82%~11016300~3025076~01/26/18~812 SBUX~Starbucks Corp~57.99~-2.56~-4.23%~51846000~3006550~01/26/18~915 DVMT~Dell Technologies Inc Cl V~82.74~-5.70~-6.45%~35703301~2954091~01/26/18~1611 MSFT~Microsoft Corp~94.06~+1.73~+1.87%~29168799~2743617~01/26/18~1751 GOOGL~Alphabet Class A~1187.56~+5.42~+0.46%~2107300~2502545~01/26/18~2462 ABBV~Abbvie Inc~123.21~+14.91~+13.77%~19614201~2416666~01/26/18~10 GOOG~Alphabet Class C~1175.84~+5.47~+0.47%~2018300~2373198~01/26/18~1675 PFE~Pfizer Inc~39.01~+1.78~+4.78%~48805004~1903883~01/26/18~55 

The pieces of data above are delimited using the ~ character. Each line of data contains the following in the order listed.

- a single space

- the stock's symbol

- name of a NASDAQ stock

- the stock's value at close of day indicated by report date

- how much the stock's value has changed since the last report

- how much the stock's value has changed since the last report as a percentage

- the number of contracts traded for the day

- the price volume (current price times current volume divided by 1000)

- the report date

- the number of shares owned

Use get(), getline() and ignore() as needed to read the needed pieces of data from the stock information file. Any data that is not needed should be ignored rather than read. For the first five stocks, display the name of the stock, the stock's value and the number of shares owned. You should then calculate and display the total amount of worth (the number of shares multiplied by the stock's value).

The above stock information would produce the following output on the screen.

Stock Name Value Quantity Total Worth Amazon.Com Inc 1402.05 1523 2135322.15 Apple Inc 171.51 1224 209928.24 Alibaba Group Holding Ltd 205.22 100 20522.00 Intel Corp 50.08 2213 110827.04 Vmware Inc 150.00 1745 261750.00 

Challenge: Display the numbers using commas.

Stock Name Value Quantity Total Worth Amazon.Com Inc 1,402.05 1,523 2,135,322.15 Apple Inc 171.51 1,224 209,928.24 Alibaba Group Holding Ltd 205.22 100 20,522.00 Intel Corp 50.08 2,213 110,827.04 Vmware Inc 150.00 1,745 261,750.00 

This program have to use C++ format. Thanks a lot and have a nice day :)

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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions