Create program to randomly access data on stocks

Assignment Help Programming Languages
Reference no: EM1370429

A small mutual company wants you to create a program to randomly access the data on stocks it holds. Presently, the data are stored in a text file, each line of which contains the following: a stock code, which is an integer between 100 and 999; the stock's current price; the change in the stock's price since the last trading day; the highest price for the stock during the last year; and the lowest price for the stock during the last year.

Write a program that uses the text file to create a corresponding relative file. Translate the stock code to an appropriate relative record address. Then, the program should allow the users to randomly access the relative file. The user should be allowed to do the following:

a. Enter a stock code and then display all the information about the stock, appropriately labeled.
b. Add a new stock to the relative file.
c. Delete a stock from the relative file.
d. Change any of the data on the stock

Periodically, usually at the end of a trading day, the mutual fund company wants to update the relative file of stock data. Assume that the new data on the stocks is in a transaction file (stored as a text file) each line of which has the following data: the stock code and the new closing price.

Write another program that updates the relative file. Do the following for each record in the transaction file:

a. Make a current price of the corresponding record in the relative file equal to the new closing price.
b. In the corresponding relative file record, make the price change equal to the difference between the old current value and the new current value.
c. If the new current value is greater than the year's highest price, replace the year's highest price with the new current value.
d. If the new current value is less than the year's lowest price, replace the year's lowest price with the new current value.

Reference no: EM1370429

Questions Cloud

Use postings intersection procedure to find list of document : Assume we want to use postings intersection procedure to find simply the list of documents which satisfy a /k clause, rather than returning list of positions.
Explain and identify ways in which individual elements : Explain and Identify ways in which individual elements of the national economic environment affect the business environment
Producers-consumers and competitive markets : Assume that the competitive firm's marginal cost of producing output q is given by MC(q)=3+2q. Suppose that the market price of the firm's product is $9. Find out level of output will the firm produce?
Explain what changes should be made to copyright law : Explain What changes should be made to copyright law to reflect the ease with which much creative material can be reproduced and distributed over the Internet
Create program to randomly access data on stocks : A small mutual company wishes you to create program to randomly access data on stocks it holds. Presently, data are stored in a text file, each line of which contains following: a stock code.
Functions of short run average variable and marginal cost : Determine the short run average variable cost and the marginal cost functions. Determine the output level that minimizes short run average variable costs
Explain the importance of focusing design on the trainee : Explain the importance of focusing design on the trainee and explain your learning style and give examples of teaching techniques
Explain the relation of control with payroll function : A potential control for managing risk of employee fraud is to send employees on mandatory vacations. Describe the relation of that control with payroll function.
Trade of importing country and exporting country : What would each of the following events do to the terms of trade of the importing country and the exporting country, other things being equal?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write application to simulate coin tossing

Write an application that simulates coin tossing. Let the program toss the coin each time the user presses the "Toss" button. Count the number of times each side of the coin appears.

  Write program to compute the volume flow rate

Write program to compute volume flow rate in cubic feet per second of water flowing through pipe of diameter d in inches and a velocity of v feet per second.

  Define function that takes year as it-s input argument

Define and call a function fast_food_billions that takes the year as it's input argument and returns the prediction as it's result. Tell the user that entry of a year before 2005 will cause the program to stop.

  Write pseudocode

Write pseudocode that represents the abstract functions of the enqueue and dequeue operations. Define and explain any supplementary information needed by your pseudocode.

  Program to simulate rolling one die

Write a program which simulates rolling one die using the following steps: Prompt the user for the number of sides on the die.

  Store normal for each face in array using technique

Use technique of the Astle text to store normal for each face in faceData array enable lighting and add point light source if the light is positioned at the origin

  Write simple program to prompt user for gross salary

Write simple program which will prompt user for his or her gross salary. Your program than will display net salary whereby 11.00% of the gross salary is deducted for EPF

  Computing average net profit per sale of product

Your company bought 250,000 online advertising impressions and made average net profit per sale of product of $5.

  Write function which take parameter-string and returns vowel

Write function which takes as parameter and string and returns the vowels (a, e, i, o, u). Function prototype should look like: void countVowels(string str, int& aCt, int& eCt, int& iCt, int& oCt, int& uCt);

  Compute and print annual salary of employee

Identify input, process and output to solves each problem. Compute and print the annual salary of employee. suppose the employee receive 6% increase in pay.

  Create a print stream object using dos

Create a PrintStream object using dos and assign the resulting reference to ps, a PrintStream variable that has already been declared.

  Complete a request for system services

Objectives Complete a Request for System Services form, which triggers the preliminary investigation phase. Analyze a user interview and extract pertinent facts, which can be used to assess project feasibility. Complete a Problem Stateme..

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