Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

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 7.1 will be used, with some modifications. write a program that The American Red Cross rant you to will calculate the average pints of blood donated during a blood drive. The pints donated during the driver based on a aven hour drive period. The average pin should be calculated and vritten to a file. rite a loop around the program be appended to the file to keep track of multiple days. If the user w nt, to print a from the file, read it in and then display it. 3tore the pints per hour and the average pints donated in a file called blood.txt program should take in the number of ts donated dur ing that period to run multiple time The data should Step 1: Note that the getints, getTatal, and getAverage functions do not change. Also note that the references to gisplaxInfo, gettigh and gettxfanctions are removed to meet the new requirements. In the pseudocode below, add the following: In the Main Module b. c. d. e. A variable named option of the data type Integer Input option Write an if statement that will determine which option to run Call a module called gKARsZe that passes pints and ausseasRARRA Call amodule called zaadFxomFide that passes pints and axerageRinaa In the yriteToEle Module f Declare an output file called hieadEHG. Reference: Appending Data to an Existing File). Open the internal file klaod ) and a text file named blood. txt. Reference: Creating a File and Writing Data to it) hadin dRRSRSg885, with the name g. h. Write the string "Pints Each Hour to the file. (Reference: Writing Data to a File). i. In the while loop, write each elament of the pints array to the bloodEle Reference: Using Loops to Process Files). j. Write the string "Average Pints" to the file. k. Write the value of averageRints to the file. Close the bloodEile (Reference: Closing an Output File). In the readomEle Module m Declare an input file called ipEilsdt with the name bleodle Reference: Reading Data from a File). n. Open the intemal file l) and a text file named blood.txt. 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 7.1 will be used, with some modifications. write a program that The American Red Cross rant you to will calculate the average pints of blood donated during a blood drive. The pints donated during the driver based on a aven hour drive period. The average pin should be calculated and vritten to a file. rite a loop around the program be appended to the file to keep track of multiple days. If the user w nt, to print a from the file, read it in and then display it. 3tore the pints per hour and the average pints donated in a file called blood.txt program should take in the number of ts donated dur ing that period to run multiple time The data should Step 1: Note that the getints, getTatal, and getAverage functions do not change. Also note that the references to gisplaxInfo, gettigh and gettxfanctions are removed to meet the new requirements. In the pseudocode below, add the following: In the Main Module b. c. d. e. A variable named option of the data type Integer Input option Write an if statement that will determine which option to run Call a module called gKARsZe that passes pints and ausseasRARRA Call amodule called zaadFxomFide that passes pints and axerageRinaa In the yriteToEle Module f Declare an output file called hieadEHG. Reference: Appending Data to an Existing File). Open the internal file klaod ) and a text file named blood. txt. Reference: Creating a File and Writing Data to it) hadin dRRSRSg885, with the name g. h. Write the string "Pints Each Hour to the file. (Reference: Writing Data to a File). i. In the while loop, write each elament of the pints array to the bloodEle Reference: Using Loops to Process Files). j. Write the string "Average Pints" to the file. k. Write the value of averageRints to the file. Close the bloodEile (Reference: Closing an Output File). In the readomEle Module m Declare an input file called ipEilsdt with the name bleodle Reference: Reading Data from a File). n. Open the intemal file l) and a text file named blood.txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions