Question: I am learning c++ programing. Please help me I have no idea this code. Lab 4: Monkey Lab Chapter 7: Using one-dimensional and two dimensional

I am learning c++ programing. Please help me I have no idea this code.

Lab 4: Monkey Lab

Chapter 7: Using one-dimensional and two dimensional arrays

50 points

You will be using arrays to track the food intake of 3 adorable monkeys for one week. After filling a 1 dimensional array with monkey names and a 2 dimensional array with food data, you will calculate and report very important statistics about the monkeys. This is cutting edge science!

Step 1)

Declare 2 global constants: NUM_ MONKEYS = 3;

NUM_DAYS = 7;

In main, declare a one-dimensional string array that will hold the names of 3 monkeys. (make up your own names for your monkeys and be creative..you may not use mine!)

In main, declare a 2 dimensional array that will hold the amount of food (in pounds) that each of the three monkeys have eaten in a period of 7 days. **Be sure to use my test data.

Step 2)

Fill the arrays

Options for filling the arrays:

Option1:

Declare the 2 arrays (1 dim for 3 names, 2 dim for food), initialize the arrays with the data to be used in the project. Use my data (see the next page).

Option2:

Declare the name array, initializing the array with the word none for all three names.

Declare the 2 dim array using 0 as the initial values for all 21 days.

Call a function and use a loop to ask the user for the monkeys names.

In the same function, ask the user for the pounds of food eaten by each of the 3 monkeys for the seven days.

Use this format: Enter the pounds eaten by monkey #1 on day #1:

Enter the pounds eaten by monkey #1 on day #2:

etc

Validate input for negative input.

**Use my test data for input.

Option 2 will earn you 4 points extra credit.

Option 3:

Read the data from a file

Declare the 2 arrays and read the data from files.

Create 2 files with the correct data and save them to your project.

Call a function that reads the files using a loop.

Be sure to check if the files exist.

Upload .txt files as well as the .cpp code and screenshot.

Option 3 will earn you 4 points extra credit

Step 3)

Create a function that prints the contents of the two arrays in this format:

Name Day 1 Day 2 Day 3 Day 4 Day 5 Day 6 Day 7

Bonnie 45 33 55 66 77 88 100

Clyde 88 77 66 55 44 33 22

Trigger 44 55 11 66 77 88 99

In the function heading, declare both arrays as constant arrays.

Format as closely as possible, but dont obsess too much over perfection.

Step 4)

Create a function that calculates and displays the average daily food intake for each of the three monkeys. In that function, display the averages with one number to the right of the decimal point. Report the results in the following format:

Name Average daily intake in pounds

Bonnie (report the results)

Clyde etc.

Trigger etc.

In the function heading, declare both arrays as constant arrays.

Step 5)

Create a function that determines the one monkey who ate the least amount of food. Output the results in that function using the following format:

Least amount of food: _Monkey # _ ate ____ pounds on Day # _____

In the function heading, declare both arrays as a constant arrays.

Extra Credit: +1 point for placing the monkey name in the output above.

Step 6)

Create a function that determines the one monkey who ate the most amount of food. Output the results in that function using the following format:

Most amount of food: _Monkey # __ ate ____ pounds on Day # _____

In the function heading, declare both arrays as a constant arrays.

Extra Credit: +1 point for placing the monkey name in the output above.

Notes:

Use my test data and formatting as suggested above.

Only document the functions.

Use variables and function names that are clear and self-explanatory.

Pass the arrays as constants where appropriate.

Use good spacing in both the code and the output.

Lab 4 Rubric (50 points)

_____ Global Prototypes (4)

_____ 2 Global constants (2)

_____ 2 arrays declared / initialized with sample data

Declared locally (3)

_____ Document functions correctly (2)

_____Function showData (10)

Declare array as constant (-2)

Nested loop (-5)

Correctly formatted output(-3)

_____ Function Calculate Daily intake (12)

Declared array as constant (-1)

Nested loop (-5)

Correct calculation of daily food intake (-4)

Reset total( -1)

Formatted with one decimal place (-1)

_____ Correct calculation of least food eaten/ most food eaten (12)

Declare array as constant (-1)

Correct monkey number (-3)

Correct amount (-3)

Correct day (-3)

_____ Extra credit (+2 for monkey names in each result)

_____ Correct use of sample output (2)

_____ Misc. (3)

_____ Extra credit: Get data from the user (+4)

initialize arrays (-1)

use function for input (-2)

validate input for negative input (-1)

_____ Extra credit: Read data from a file (+4)

check that file exists(-1)

close files (-1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!