Assignment - file access and pseudocode

Assignment Help Programming Languages
Reference no: EM13810909

Assignment - File Access and Pseudocode

Critical Review

When a program needs to save data for later use, it writes the data in a file. The data can be read from the file at a later time.

Three things must happen in order to work with a file. 1) Open a file. 2) Process the file. 3) Close the file.

An internal file must be created for an output file or input file, such as:

Declare OutputFile myFile //to write out
Declare InputFile myFile //to read in

A data file must also be created to store the output, such as:

Open myFile "thedata.txt"

New keywords and syntax include the following:

Open [InternalName] [FileName]
Write [InternalName] [String or Data]
Read [InternalName] [Data]
Close [InternalName]
AppendMode //used with Open when need to append

Loops are used to process the data in a file. For example:

For counter = 1 to 5
Display "Enter a number:"
Input number
Write myFile number
End For

When reading information from a file and it is unknown how many items there are, use the eof function. For example:
While NOT eof(myFile)
Read myFile number
Display number
End While

This lab examines how to work with a file by writing pseudocode. Read the following programming problem prior to completing the lab. The following program from Lab 9.1 will be used, with some modifications.

The American Red Cross wants you to write a program that will calculate the average pints of blood donated during a blood drive. The program should take in the number of pints donated during the drive, based on a seven hour drive period. The average pints donated during that period should be calculated and written to a file. Write a loop around the program to run multiple times. The data should be appended to the file to keep track of multiple days. If the user wants to print data from the file, read it in and then display it. Store the pints per hour and the average pints donated in a file called blood.txt.

Reference no: EM13810909

Questions Cloud

Explain the difference between roots and routes : The analysis of the psychological process of terrorism is Explain the three phases of terrorism and the significance of understanding terrorism as a psychological process. Explain the difference between "roots" and "routes" regarding individual pat..
Explain the theories of adult learning principles : Explain the theories of adult learning principles. Compare the differences between child/adolescent and adult learning models (pedagogy and andragogy).
Assignment - file access and flowcharts : Assignment - File Access and Flowcharts, The Output symbol is used to output data to a text file. When an Output symbol is reached during Raptor program execution, the system determines whether or not output has been redirected
Gender and racial stereotyping : gender and racial stereotyping
Assignment - file access and pseudocode : Assignment - File Access and Pseudocode, When a program needs to save data for later use, it writes the data in a file. The data can be read from the file at a later time
Why business should speak out on immigrant workers : Why business should speak out on immigrant workers
Illegal aliens cost california billions : Illegal aliens cost California billions
Legal and illegal immigration into the united states : Legal and illegal immigration into the United States
Define civilian ic members and the military : In the last few weeks you have reviewed a majority of Intelligence Community members. This week you explore DIA and the military services. What do you find are the biggest differences between civilian IC members and the military.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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