Write one program c++ | CSC Pro Design | Onondaga Community College

 

Write one program that does the following:

1.  Ask the user for ten (10) grades, and store the data in an array.  Compute the average of all the grades.  Print the original ten grades and the average.

a.  Declare an integer array with the name of “grades” of size 10 in the main function.

b.  Create a function called “getGrades” that prompts the User for the grades and puts them in an integer array.

 i.  The function will receive an integer array and the size of the array.

 ii.  In the function prototype and the function header, call the array “gradeArray” and call the size of the array “size.”

 iii.  Create a For Loop that cycles through each cell of the array.

 iv.  At each cell prompt the User for a grade.

 v.  Store the grade entered by the User into the array cell.

c.  From main, send this function the array called “grades” and the size of the array.

d.  Create a function called “computeAverage” that computes the average of an array of integers and returns the average as a float.

 i.  The function will receive an integer array and the size of the array.

 ii.  In the function prototype and the function header, call the array “numbers” and call the size of the array “size.”

 iii.  Create a For Loop that cycles through each cell of the array and computes a running total of the values stored in the array.

 iv.  Use the size of the array to compute the average from the running total.

 v.  Return the average through the function name.

e.  From main, send this function the array called “grades” and the size of the array.

f.  From main, print out the average returned by computeAverage.

g.  Create a third function called “printInts” that will print out the contents of an integer array.  This function will be void.

 i.  The function will receive an integer array and the size of the array.

ii.    In the function prototype and the function header, call the array “intArray” and call the size of the array “size.”

iii.  Create a For Loop that prints out the contents of the array.

2.  Generate 20 random numbers within a range of 1 to 50 and store them in an integer array named “randomArray.”  Then print out the contents of the array.

a.  Create a function named “getRandom” that will generate a random number between any range.

 i.  The function will receive two call-by-value arguments – the beginning value of the range and the ending value of the range.

 ii.  Generate a random number within the specified range.

 iii.  Send the random number back through the function name.

b.  In the main function, create a For Loop that cycles through the array called randomArray.

 i.  With each cycle, call your getRandom function from main and store the random number it returns into your array.

c.  In main, call the function printInts to print out the contents of the array called randomArray.  Make sure you use the SAME FUNCTION you created in step 1.  You are just sending it a different array.

d.  Next, in the main function, call the function computeAverage to compute the average of the random numbers you stored in the array called randomArray.  Make sure you use the SAME FUNCTION you created in step 1.  You are just sending it a different array.

e.  In main, print out the average returned by computeAverage.







Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Get 15% OFF on your FIRST order. Use the coupon code: new15