Write program to use text file to create relative file

Assignment Help Programming Languages
Reference no: EM1362756

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. The program could also update the relative file. The user could 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: EM1362756

Questions Cloud

Prepare conscientiousness : Develop Conscientiousness - How can a person develop a greater amount of conscientiousness in his or her own work
Three factor dupont analysis for starbucks : Conduct a three factor DuPont analysis for Starbucks and Dunkin' Donuts for 2011 and 2012 end-of-year results. Use the information from financial statements in the 2012 annual reports.
What are the ramifications of failing to meet the challenge : Utilizing an information provided in your course text, complete the "Motivation Concepts Table." This table will serve as a convenient quick reference for the remainder of the course.
Corporations buy back : Explain why do corporations buy back their own stock? What does it tell you about the corporation? What effect does the purchase have on the price of a company's stock?
Write program to use text file to create relative file : Write a program that uses the text file to create a corresponding relative file. Translate the stock code to an appropriate relative record address.
Would the employee be better or if : Would the employee be better or if, instead of the health insurance, she was given a £100 per week pay increase which would be taxed at 20%.
Impairment of intengible assets : A toffee company discovers that its competitor is producing and selling what appears to be its patented toffee-coated popcorn for a cheaper price.
Explain about market pull approach : Market Pull Approach - In explain what circumstances might a market-pull approach to new-product design be the best approach?
Explain to accommodate a rapidly growing and aging community : Explain To accommodate a rapidly growing and aging community and  it is necessary to expand capacity for long-term care by constructing a new hospital wing.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write program-compute average using floating-point numbers

Write a program that will accept as input between 2 and 25 numbers and then calculate the average of the numbers. Make sure you use floating-point numbers in case the average is not a whole number.

  Write program to simulate bank transaction

Write a program to simulate a bank transaction. There are two bank accounts: checking and savings. First, ask for the initial balances of the bank accounts.

  Top-down recursive descent parser

Write a hand-coded top-down recursive descent parser.

  Function to retrieve each of the private data members

Write a class called "Date" with month, day and year as private members. Have constructor that sets default date to 1st January 2000. Have accessor function which retrieves each of the private data members.

  Creating loop to find number of items bought based on price

Make a block using a loop that will find the number of items that can be bought based on the price of the item and the total amount available to spend.

  Write a program that will generate an array

Write a program that will generate an array

  Design logic that continuously prompt user for numeric value

Design the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number

  Function to count number of times the given number occured

Write a main function to input 20 integers in the range of 1 to 6. Write a function to count the number of times the numbers 2 and 5 occur. The function should declare static variables count2 and count5.

  Program using ten radio buttons to show five states

It is program using 10 Radio Buttons to show 5 States and 5 Capitals to user's interface. Also, there is text box to print "Correct" and "Incorrect" when Sate and the Capital is a correct match.

  Write the constructor function makestk

Write the constructor function makestk, predicate function emptystk and mutator functions pushstk and popstk

  General layout for a web-based source document

Suggest the general layout for web-based source document that prospective sellers could use to explain their antiques. Information must include the user ID, password, item, dimensions, origin, condition, and asking price.

  Write code for invoking method named sendtwo

Write the code for invoking a method named sendTwo. There are two arguments for this method: a double and an int.

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