Create a menu driven application that uses information

Assignment Help Computer Engineering
Reference no: EM132208381

Write the program in c++ only

Create a menu driven application that uses information in files to keep track of your stock portfolio. The data is stored in the file "stocks.txt". An example file is as follows:

Amgen#200 50.75 75.625

Delta#100 111.75 97.25

Novell#500 10.375 12.25

PPG Inc#100 56.75 54.5

Timken#300 34.625 15.125

HP#100 100.50 115.25

Note that each line has the format : Company name#number_of_shares purchase_price current_price

Note that there must be a delimiter after the company name. In this case we are using the ‘#' character. Also notice that there are spaces between the numbers.

The program should begin by displaying a menu as shown in the sample output below. For option 1 (add stock): Prompt the user for the new data. You will have to create a file object, open the file with append flag (ios::app) to append the data to the file. Don't forget to close the file!

For option 2 (display profit/loss): Create a file object, open the file for input, read the file, calculate and display the profit or loss on each, and the total value. Note the formatting! Don't forget to close the file!

USE FUNCTIONS to organize your code! You should make a function for adding records, and another function for displaying the profit. Main should be simple. You do not need any file objects in main. Handle the files in the functions.

Testing - show the following output:

Use the file "stocks.txt" shown above

? Select option 2 - should produce the results shown below.

? Now select option 1 and add the following stocks:

Sample output:

Options

1 Add Stock

2 Display Profit/Loss

3 Exit Program

Enter menu option: 2

Portfolio Report

================

Company Profit(Loss)

Amgen $ 4975.00

Delta $ -1450.00

Novell $ 937.50

PPG $ -225.00

Timken $ -5850.00

Total value $ -1612.50

Options

1 Add Stock

2 Display Profit/Loss

3 Exit Program

Enter menu option: 1

Enter company (X to stop adding records): cisco

Enter number of shares: 400

Enter purchase price: 22.00

Enter current price: 16.50

...etc

Enter company (X to stop adding records): x

New records have been added

Options

1 Add Stock

2 Display Profit/Loss

3 Exit Program

Enter menu option: 2

(check new results)

Press any key to continue

Reference no: EM132208381

Questions Cloud

A program to show the truth table for a simple wff : Write a program in C++ that will output the truth table for a simple wff. There will only be Ps and Qs, so you can hard code the P truth table
Determine how you derived your solutions : Suppose a 6-year timeframe where the interest rate for the first 2 years is 10%, the interest rate for the next 2 years is 12% and the interest rate.
How many values in the array are not a multiple of 2 : The program should print the number of odd values in the array, that is how many values in the array are not a multiple of 2.
When is the final for the given class : Explain what effect a reduction in productivity has on wage setting behavior, P setting behavior, the equilibrium real wage, the natural rate of unemployment.
Create a menu driven application that uses information : Create a menu driven application that uses information in files to keep track of your stock portfolio.
Print out the values of the integers entered : Write a program in C that accepts two integer inputs from a user (through scanf() ), and assigns them to integer variables a and b.
Develop the cost management plan for your assigned rocket : Given the information provided for your assigned rocket assembly project: Develop the cost management plan for your assigned rocket assembly project
Complete the code and test your client by sending email : Your job is to complete the code and test your client by sending email to different user accounts.
Write down the rule for schooling choice : Write down the rule for schooling choice (present value vs. cost). Use this model to analyze how the following factors affect the choice.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd