0% found this document useful (2 votes)
196 views

Assignment 2 - Csit221

This document provides the instructions for Assignment 2 for the course CSIT 221 - Computer Science II in Spring 2018. It includes 5 programming problems to be completed and submitted by February 22nd, 2018 through the onCourse system and a printed copy. Each problem is worth 20 points. The problems involve generating a 2D array of random integers and finding peaks, calculating student test scores and grades using arrays, modifying the read and write functions to use files, redoing the student problem using a struct, and sorting and reporting on the struct array.

Uploaded by

Tyler Harrison
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (2 votes)
196 views

Assignment 2 - Csit221

This document provides the instructions for Assignment 2 for the course CSIT 221 - Computer Science II in Spring 2018. It includes 5 programming problems to be completed and submitted by February 22nd, 2018 through the onCourse system and a printed copy. Each problem is worth 20 points. The problems involve generating a 2D array of random integers and finding peaks, calculating student test scores and grades using arrays, modifying the read and write functions to use files, redoing the student problem using a struct, and sorting and reporting on the struct array.

Uploaded by

Tyler Harrison
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment 2 CSIT 221 – Computer Science II Spring 2018

Due Feb 22nd, 2018 at the beginning of class.

Please submit the code for each problem on onCourse in a single Word document or text file. In addition, a printed copy
of the assignment (in a readable format) is due at the beginning of the class on the due date. Make sure your programs
run!!!!
Each problem is worth 20 points.

1. Write a program that randomly generates a 20 x 20 two-dimensional array, board, of type int. An
element board[i][j] is a peak (either a maximum or a minimum) if all its neighbors (there should be either 3, 5, or 8
neighbors for any cell) are
• less than board[i][j] (i.e., a maximum peak) or
• greater than board[i][j] (i.e., a minimum peak)

The program should output all elements in board, with their indices, which are peak. It should also output if a peak is a
maximum or a minimum.

2. Write a program to calculate students’ average test scores and their grades (>=90 is an A, >=80 is a B and so on). You
may assume the following input data:
Johnson 85 83 77 91 76
Aniston 80 90 95 93 48
Cooper 78 81 11 90 73
Gupta 92 83 30 69 87
Blair 23 45 96 38 59
Clark 60 85 45 39 67
Kennedy 77 31 52 74 83
Bronson 93 94 89 77 97
Sunny 79 85 28 93 82
Smith 85 72 49 75 63
Use three arrays: a one-dimensional array to store the students’ names, a (parallel) two-dimensional array to store the test
scores, and a parallel one-dimensional array to store grades.
Your program must contain at least the following functions:
• a function to read and store data into two arrays
• a function to calculate the average test score and grade
• a function to output the results.
Have your program also output the class average.

3. Modify the read and write functions in problem 2, so that you read from a file and store the results in a file.

4. Redo problem 2, but using only 1 array of an appropriately defined struct studentType. Read the data from a file and
store the results in a file. (The resulting text files should be the same as in 3)

5. Sort the array in Problem 4 based on the average test Score. Store the sorted data in a file. In a separate file, write a
report with the number of A’s, B’s, C’s, D’s and F’s given.

You might also like