Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

only in c++ I need a program that follows this format: /* * CECS 2203, Computer Programming I Lab * Winter 2022, Sec. 06 *

only in c++ I need a program that follows this format:

/* * CECS 2203, Computer Programming I Lab * Winter 2022, Sec. 06 * Date: January 12, 2023 * Topic: Lab 4 - Arrays * File name: lab04.cpp * Name: [YOUR NAME HERE], ID#[YOUR ID NUMBER HERE] */ // write the required preprocessor directives void setValues(? ? ? ); // this method receives an integer array and its size as parameters int addValues(? ? ? ); // this method receives an integer array and its size as parameters int highest(? ? ? ); // this method receives an integer array and its size as parameters int lowest(? ? ? ); // this method receives an integer array and its size as parameters float average(? ? ? ); // this method receives an integer array and its size as parameters void printValues(? ? ? ); // this method receives an integer array and its size as parameters void personalInfo(); int main() { // declare an integer constant named SIZE and initialize to 7 // declare an intger array named values using the constant as the size // and initialize all elements to 0 // call the printValues method // call the setValues method to populate the array // call the printValues method // print the phrase "The sum of the values in the array is [sum], the highest value is // [high], the lowest value is [low], and the average of all values is [average]." // Call the appropriate functions to obtain the sum, highest, lowest, and average values. // call the personalInfo method system("pause"); // For Visual Studio only! return 0; } // The setValues method receives an integer array and its size as parameters and has no // return value. If uses the pseudo random number generator function to assign a value // between 1 and 100 to every element of the array. Make sure to seed the pseudo random // number generator before calling the rand function. The only variable declared in this // method is the counter used in the for iteration control structure. // The addValues method receives an integer array and its size as parameters and returns // an integer value. Declare the local integer variable suma and initialize it to 0. // The method implements a for iteration control structure to add all values in the array // and returns the sum. // The highest method receives an integer array and its size as parameters and returns // an integer value. Declare the local integer variable high and initialize it to the // value of the first element of the array. The method implements a for iteration control // structure to find out the highest of all values in the array, and returns such value. // The lowest method receives an integer array and its size as parameters and returns // an integer value. Declare the local integer variable low and initialize it to the // value of the first element of the array. The method implements a for iteration control // structure to find out the lowest of all values in the array, and returns such value. // The average method receives an integer array and its size as parameters and returns // a float value. Declare the local float variable suma and initialize it to 0. // The method implements a for iteration control structure to add all values in the array // and returns the average. // The printValues method receives an integer array and its size as parameters and has no // return value. It prints the contents of the array using the phrase // "The values stored in the array are: [first value], ..., [last value]." // Use a for iteration control structure to print the values, making sure that a comma and // a space are printed after all but the last values. A period and the end of line instruction // must be printed after the last value. Make sure to add a blank line after the phrase is printed. // The personalInfo method prints a statement with your personal information using // the phrase "***** Program developed by [YOUR NAME], ID# [YOUR ID NUMBER] *****" // where the square brackets and the text within is substituted with your personal // information. Make sure to add a blank line after the phrase is printed.

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

Step: 3

blur-text-image

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions