Custom Search
 
  

 
CHAPTER 7

EXERCISES

1. Draw a flowchart and write a program to create a file to keep track of stock purchases. Use the file processing statements presented in this chapter. The file should include a record for each stock purchased. Each record should be composed of three data fields: name of stock, purchase price per share, and number of shares bought. Use the INPUT statement to enter the data for the file.

2. Four candidates are running for public office. To win, a candidate must receive over 50% of the votes cast. Draw a flowchart and write a program to accumulate total votes for each candidate and determine if a candidate has won or if a runoff election is required. Print the result and print each candidates name and total votes for each. The file to be used as input is stored on tape or disk and consists of records from six districts. Each record contains the following fields:

1. Candidate number (1-4)variable X

2. Candidate namestring variable N$

3. District number (1-6)variable D

4. Number of votesvariable V

The records in the file are in no particular order.







Western Governors University
 


Privacy Statement - Copyright Information. - Contact Us

Integrated Publishing, Inc. - A (SDVOSB) Service Disabled Veteran Owned Small Business