You are on page 1of 4

Name: Ismael Orozco

Grader: Nils Carlson


Assignment: Lab 4
Grade Total
Final Grade 70 100
70
Graders! Take points off if output is not close to what is
given! Function names should be appropriate!
vector.script
 Must be in 1 script called vector.script 3 3
 Script has the following output: 18 24
 (array names may differ, but values must be the same. Problem numbers are
included for ease of grading but are not required in the script. ARRAY VALUES MUST
BE HARD CODED! NO USER INPUT!)
 (3 points each question)

1.
Before
a1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}
After the array is multiplied by an integer (5 is used as an example, however students
may use any integer as the multiplier)
a1[] = {5, 10, 15, 20, 25, 30, 35, 40, 45, 15}

2.
Before
a2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}
After the array is summed with an integer (3 is used as an example, however students
may use any integer for the sum)
a2[] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 6}

3.
Before
a3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}
b3[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
After array a is copied to array b
a3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}
b3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}

4.
Before
a4[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}
b4[] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}
After the arrays are added and stored in array c
a4[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}
b4[] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}
c4[] = {11, 12, 13, 14, 15, 16, 17, 18, 19, 13}
5.
Before
a5[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}
b5[] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}
After the arrays are multipled and stored in array c
a5[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 3}
b5[] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}
c5[] = {10, 20, 30, 40, 50, 60, 70, 60, 90, 30}

6.
Before
a6[] = {1, 2, 3, 4, 5}
b6[] = {6, 7, 8, 9, 10}
After the arrays are invert-multiplied and stored in array c
a6[] = {1, 2, 3, 4, 5}
b6[] = {6, 7, 8, 9, 10}
c6[] = {10, 18, 24, 28, 30}

7.
Before
a7[] = {1, 2, 3, 4, 5}
After the array is reversed
a7[] = {5, 4, 3, 2, 1}

8.
(Prints any 10 random ints in an array)

Add function should take in the integer to add as a parameter. Why hard code the
function to add 3? Same for multiply

Printing the arrays should not be done in the array_sum, array_product, etc functions.

Incorrect output format

lab4_q1.txt
 Student writes 2-3 paragraphs stating pros and cons to using arrays and structs 5 5
 An example is given of each (array and struct) 0 5
Example of where arrays would be appropriate and example where structs would be
appropriate?

lab4_q2.c
 Enum must look like this: 8 8

enum color
{
RED=18 , ORANGE , YELLOW=5 , GREEN , BLUE , INDIGO=14 , VIOLET
};

lab4_q2.script 2 2
 Output is:
RED = 18
ORANGE = 19
YELLOW = 5
GREEN = 6
BLUE = 7
INDIGO = 14
VIOLET = 15

lab4_q3.c and lab4_q3.script


 Calculates Euclidean and Manhattan distance (1 point each) 1.5 2
 Uses point structure to store the points 0.5 1
example:
◦ struct point
◦ {
▪ double x;
▪ double y;
◦ }
You shouldn’t store both points in the same structure.
 Includes script showing example of both distances 1 1

lab4_q4.c and lab4_q4.script


 Calculates Zodiac Sign(1 point each) 0 2
 Uses structure to store the dates 0 2
◦ uses unsigned shorts
◦ includes day, month, and year
 Uses Enumeration 0 1
 Includes script 0 1
Problem not done

array_struct.c
 Student wrote the body of the fill_array() function to match the prototype found 4 4
in the array_struct.h file
 Student wrote the following functions that all return the index: (names don't 6 8
matter) (2 points each)
◦ find min of ages
◦ find min of heights
◦ find max of ages
◦ find max of heights
All these functions should return the index rather than the value. E.g. min_age should
return the index of the structure with the lowest age rather than the lowest age
 Student wrote the following functions that return the average: (2 points each) 3 8
◦ find average age
◦ find average height
Average is not calculated correctedly. You must sum all the ages and then divide by size
 Student wrote function to print an individual structure, returns nothing 0 2

array_struct.script
 Student prints out each structure that corresponds to the min age, the max age, 3 6
the min height, and the max height
Should print out the structure containing the min age, etc
 Student prints out the average age and the average height 2 2
 Student uses data in the array_struct.c file 3 3

README: (6.7%)
 Has detailed conclusion with the following sections: 10 10
◦ What I learned (4 points)
◦ Issues and how I fixed them (bug report) (4 points)
▪ NOTE: Bug report cannot be empty or “no bugs” - this is a summary of
bugs encountered during the coding process and is required.
◦ Improvements that can be made (2 point)
Comments:

You might also like