For each problem in the assignment, you will create the definition of the user-defined function
that is asked in the description. If you do not create a user-defined function for each of the
problems, then you will receive no credit for the problem. Creating user-defined functions
is good practice! You also must write the function prototypes! Missing function prototypes will
result in points being deducted. Function prototypes are also good practice as well. The file
must be named smallprogram6_lastname_firstname.c, where lastname and firstname is your
last and first name (as registered in webcourses). For example Dr. Steinberg’s file would be
named smallprogram6_Steinberg_Andrew.c. Make sure to include the underscore character _.
If your file is not named properly, points will be deducted. The script the graders use will pull
your name from the file name properly. It is imperative you follow these steps so you can get
Small Program 6 Page 1
your points!
Testing on Eustis
It is your responsibility to test your code on Eustis. If you submit your assignment without testing on Eustis, you risk points being deducted for things that may behave differently on your
operating system. Remember, you cannot dispute grades if your code didn’t work properly on
Eustis all because it worked on your machine. The Eustis environment gives the final say. Plan
accordingly to test on Eustis!!
The Python Script File! Read Carefully!
A python script has been provided for you to test your code with a sample output of Dr. Steinberg’s solution. This script will check to make sure your output matches exactly with Dr. Steinberg’s solution file as the graders are using this to grade your assignments. The script removes
leading and trailing white space, but not white space in the actual text. If there is anything off
with the output (including the expected answer), the script will say your output is not correct.
This includes your output producing the correct answer, however there is something off with the
output display. The script is going to run 5 unique scenarios for each problem (5 Test Cases).
Each test case contains a different set of input values being used to ensure your code produces
the correct answer. Back in your previous assignments, Dr. Steinberg would provide 1 sample
solution that you would upload to Eustis. Now, there are 5 solution text files you are going to
need to upload to Eustis. Before you test your program, your directory in Eustis should look
something like this: After you run the script, 5 new text files are going to be generated. These
Figure 1: Your setup for testing on Eustis. 5 sample txt files (provided for you in Webcourses),
your C program, and the python test script.
files are the solution output for each test case. If you have these files, you are ready to run
the script. Use the following command to test your code with Dr. Steinberg’s provided solution
sample.
python3 sp6test.py
Small Program 6 Page 2
Figure 2: Your Eustis setup after running the script in Eustis.
The Rubric
Please see the assignment page for the established rubric on webcourses.
Comment Header
Make sure you place a comment header at the top of your C file. You will use single line comments to write your name, professor, course, and assignment. For example, Dr. Steinberg’s
header would be:
//Andrew Steinberg
//Dr. Steinberg
//COP3223C Section 1
//Small Program 6
Missing a comment header will result in point deductions!
Small Program 6 Page 3
Problem 1
Write a user defined function called meanMinMax that takes an int array as an argument. The
function will use the array that is declared in the main function that contains SIZE elements. The
function will calculate the mean of the values stored in the array and also determine the max
and min values inside the array within the function definition. These results will be displayed in
the user defined function definition. The following figure shows a sample output of the problem.
Read the Important section of this assignment to understand the array you are using for
all of these problems.
Figure 3: Sample output from problem 1. Make sure it matches for the python script.
Problem 2
Write a user defined function called mySort that takes an int array (same one from the previous
problem) as an argument. The function will sort the array in increasing order. Do not use any
built in sorting function. If a built in sorting function is used, then no credit will be given for
this problem. The following figure shows a sample output of the problem. Call the display
function after calling mySort in the main function.
Figure 4: Sample output from problem 2 from calling display after mySort. Make sure it matches
for the python script.
Small Program 6 Page 4
Problem 3
Write a user defined function called doubleShift. This function shifts values over by 2 indexes
to the right (increasing index) in the array. Here is an example when the array has 5 elements
before and after the function is called. The function takes the int array (same one from previous
problems) as an argument.
Figure 5: Sample of how doubleShift works with an array of 5 elements.
Call the display function after calling doubleShift in the main function.
Figure 6: Sample output from problem 3 from calling display after doubleShift. Make sure it
matches for the python script.
Small Program 6 Page 5
Problem 4
Write a user-defined function called reverse. The function flips the position of the values in
reverse order. The following figure shows a sample with an array of 5 elements. You cannot use
Figure 7: Sample of how reverse works with an array of 5 elements.
an additional array for this problem. If an additional array is used, then points will be deducted.
Call the display function after calling reverse in the main function.
Figure 8: Sample output from problem 4 from calling display after reverse. Make sure it matches
for the python script.
COP3223C, Introduction, program, Programming, Small, solved, with
[SOLVED] Small program 6 cop3223c introduction to programming with c
$25
File Name: Small_program_6_cop3223c_introduction_to_programming_with_c.zip
File Size: 555.78 KB
Reviews
There are no reviews yet.