Assignment Goals: To learn to use arrays and control structures to process data. Assignment: 1. Reading: Chapter 8. 2.Textbook: Starting Out with C++: Early Objects, 9th Edition, by Tony Gaddis, Judy...

1 answer below »
Assignment Goals: To learn to use arrays and control structures to process data. Assignment: 1. Reading: Chapter 8. 2.Textbook: Starting Out with C++: Early Objects, 9th Edition, by Tony Gaddis, Judy Walters, and Godfrey Muganda, Pearson, 2016. ISBN-13: 9780134400242. ( Sorry I can't provide the textbook)


Programming Exercise: Write a program to perform the following tasks: 1) Create a txt file named “hw1data.txt” that contains 30 students’ test scores in the range of 0~100. Assume test scores are integers. You can use the following sample data: 76 84 75 62 58 75 93 54 36 87 81 88 68 90 73 80 74 84 96 100 61 50 84 47 92 87 76 87 82 64 2) Read 30 test scores from the file “hw1data.txt” and store them in a one-dimensional array. 3) Write a function printList that prints the content of an array on the screen. The function has two formal parameters: an int array and an int variable containing the size of the array. 4) Write a function getLargest that finds and returns the largest value (first occurrence if more than one) in an array. 5) Write a function getSmallest that finds and returns the smallest value (first occurrence if more than one) in an array. 6) Write a function getAverage that finds and returns the average value of an array. The average value should be of type double. 7) In the function main, call the above functions to output all the test scores stored in the array, as well as the highest, the lowest, and the average test score. 8) In the function main, write statements to find the number of scores in each of the following ranges: 1) 0-50 (0 2) Declare file stream variable for example, ifstream infile; 3) Open input file for example, infile.open(“hw1data.txt”); 4) Input data from file for example, infile >> x; 5) Close the file infile.close(); Submission: Name your source file as hw1main.cpp when you create your C++ project and only submit your source file hw1main.cpp as an attachment via the Homework1 Submission link on Blackboard. Do NOT submit your project files. Please include the integrity statement “I certify that this submission is my own original work” and your name and RAM ID as comments in the source file.
Last, Modify your program so that it can read and process a flexible number of scores, assuming the total number of scores is no more than 200. In addition, in the function main, output the total number of scores read from the file. Hints: Consider using an array of size 200 and using a while loop to read all the scores from a file and track the number of scores that have been read.
Answered Same DaySep 23, 2020BUS102

Answer To: Assignment Goals: To learn to use arrays and control structures to process data. Assignment: 1....

Samrakshini R answered on Sep 26 2020
146 Votes
arrays/arrays.cbp
    
    
        
        
        
        
            
                
                
                
                
                
                    
            
    
            
            
                
                
                
                
                
                    
                
                
                    
                
            
        
        
            
            
        
        
        
            
            
            
        
    
arrays/arrays.depend# depslib dependency file v1.0
1537966926 source:d:\tutoring\arrays\main.cpp
    
    
arrays/bin/Debug/arrays.exe
arrays/hw1data.txt76 84 75 62 58 75 93 54 36 87 81 88 68 90 73 80 74 84 96 100 61 50 84 47 92 87 76 87 82 64
arrays/main.cpp#include
#include
using namespace std;
void print_list(int arr[],int n)
{
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here