Program containing variable length groups of data

Assignment Help Biology
Reference no: EM1388414

Create a program that will read a file containing variable-length groups of data and report the average value of each group.

Begin by using a text editor to store the following data in a file named group.dat:
5 96 87 78 93 21 4 92 82 85 87 6 72 69 85 75 81 73

The data is arranged in the file so that each group of numbers is preceded by the number of data items in the group. Thus, the first number in the file, 5, indicates that the next five numbers should be grouped together. 
The number 4 then indicates that the following four numbers are a group, etc.
Write a C++ program to read the file group.dat, calculate the average of each group, and display it on the screen. [Hint: use nested loops]

Your program must do the following:
• Prompt the user and enter the filename from the console
• Open the file and confirm that the file opened correctly. If not, inform the user and continue to solicit a filename until it opens correctly or the user indicates he/she does not want to continue 
• Display the average value for each of the groups in the file

Note: Your program should work for any data file formatted in this fashion. You do not know how many groups of numbers will be included. To check this, you should create another test case with a different number of groups.
Example:
Enter filename: groups.dat
File groups.dat failed to open.
Abort? (y/n): n
Enter filename: group.dat
Group 1 has 5 numbers. Average = 75.00
Group 2 has 4 numbers. Average = 86.50
Group 3 has 6 numbers. Average = 75.83

Reference no: EM1388414

Questions Cloud

Determine the components of the force-close fitting hole : In the design of the robot to insert the small cylindrical part into a close-fitting circular hole, the robot arm must exert a 90-n force p on the part parallel to the axis of the hole as shown. Determine the components of the force which the part..
Program-compute monthly interest-print next balance for sav : Set annual interest rate to 4% then compute monthly interest and print next balance for both savers. Then set annual interest rate 5%. Compute next month interest and print next balance for both savers.
Having separate payroll departments in each division : Having separate payroll departments in each division of a divisional structure is an example of which of the following? Efficiency, because payroll departments compete.
Private health insurance-government sponsored health care : With respect to financing, Critically discuss the main differences between private health care insurance and government sponsored health care for persons over age 65 (Medicare)?
Program containing variable length groups of data : Create a program that will read a file containing variable-length groups of data and report the average value of each group.
Probability regarding the arrival of bus : Assume that a study of 500 randomly selected school bus routes showed that 480 arrived on time. Is it "significant" for a school bus to arrive late?
Ethical principles that should guide budget development : Critically discuss the ethical principles that should guide budget development? If a department is consistently going over budget, yet the department's management is sound, Discuss some of the things that could be causing the problem?
Finding possible pathways : Suppose that a series of compounds has been found in  Neurospora . Compounds A-F appear to be members of an enzyme pathway.
Examine hard-to-obtain data from two separate databases : You are interested in examining some hard-to-obtain data from two separate databases. Each database comprises numerical values - so there are 2n values total

Reviews

Write a Review

Biology Questions & Answers

  How many chromosomes must be present

How many chromosomes must be present

  Genetics concepts

Explain how many kinetochores are there within the human cell at mitosis? Surprise, your boss has invited himself or herself to dinner! All you have is some wilted, day old lettuce.

  What are three parts cell respiration has

what are three parts Cell respiration has. Where in the cell is each found, the molecule(s) that enter each, the molecules at the end of each, and the number of ATPs harvested from each.

  Find the appropriate antidote for the toxicity

A thirty-five year old man has been brought in to the hospital with severe vomiting, diarrhea, abdominal cramping, and bradycardia.

  Anatomical structure of ten different organelles

Examine the anatomical structure of ten different organelles in the cell and their respective functions and Analyze five different types of connective tissue with examples of functions and location within the body.

  Explaining different concepts of the genetics

What is the function of the polymerase chain reaction (PCR) in genetic engineering? To cut DNA into many fragments.To carry DNA into a new cell.To make millions of copies of a specific segment of DNA.

  How edta promotes the dissociation of animal cell tissue

Describe how EDTA promotes the dissociation of animal cell tissue. How various genotypic and phenotypic combinations are possible in the offspring of a brown-eyed, red-haired, taster man with AB blood group (Bb rr Tt AB) married to the blue-eyed, non..

  Define the following signaling pathways in a cell

Compare and contrast, in depth, the cellular processes of mitosis and meiosis. Include interphase in your explanation. Chromosomal movement and status must be included in your answer. You may include a diagram to explain your answer but you should..

  Pros and cons of random addition or deletion of nucleotides

explain the advantage and disadvantage of random addition or deletion of nucleotides at VDJ junctions during re-arrangement of immunoglobulin gene segments.

  Find the ratio observed across all traits

State which genes are dominant genes that get expressed over the other genes and which genes are recessive the genes that will not be expressed when the dominant gene is present.

  The amount of energy emitted by the sun in 1 second

Give details how those mutations can potentially result in cancer. Make sure you list all references used for information and images.

  How to describe an action potential

Compare the divisions of the autonomic nervous system's effect on heart rate and stroke volume.how to Describe an action potential.

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