Contract Grading
On time
C requirements -- A total of 10 activities with any one of them on the computer.
B requirements -- A total of 10 activities. They should include any four B Level Activities, one
of which should be on the computer.
A requirements -- A total of 10 activities. They should include any four B Level Activities and
any one A Level Activity on the computer.
Bonus:
If you hand this assignment in ON TIME, you get one letter grade higher than indicated above. You can get an A+ by meeting the A requirements, which is averaged one letter grade higher than an A.
You also get four activities.
If you hand this assignment in SLIGHTLY LATE, you get four activity bonus. However, you don't get the one letter-grade bonus.
The dates for ON TIME and SLIGHTLY LATE will be announced in class when we discuss a few problems.
ITEM A.
Data collected from a Landsat satellite surveying the earth's service is represented as a 10 x 10 array. Each element corresponds to a one-square mile patch of land
The number in each array element will be 1 if the region is water. (Other numbers represent forests, farm land, etc.) You are to determine howmany distinct contiguous bodies of water are represented in the figure.
| 1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1 |
| 1 | 1 | 1 | 9 | 10 | 1 | 11 | 12 | 14 | 1 |
| 6 | 4 | 3 | 2 | 4 | 1 | 7 | 8 | 9 | 1 |
| 11 | 12 | 4 | 2 | 1 | 1 | 1 | 12 | 12 | 1 |
| 12 | 12 | 12 | 12 | 12 | 1 | 12 | 12 | 12 | 1 |
| 3 | 3 | 3 | 3 | 3 | 1 | 3 | 4 | 3 | 1 |
| 5 | 5 | 5 | 5 | 5 | 1 | 5 | 5 | 5 | 5 |
| 5 | 5 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 |
| 6 | 5 | 6 | 5 | 6 | 1 | 1 | 1 | 1 | 6 |
| 5 | 5 | 5 | 5 | 1 | 1 | 1 | 1 | 5 | 5 |
ITEM B. COUNTS AS 3 LEVEL A HOMEWORK ASSIGNMENTS This is an exercise in three-dimensional arrays.
An oilfield geological situation is represented as a 10 x 10 x 10 array. The first dimensions represents the depth of a given location while the other two dimensions represent distances along the ground (say an east-west distance and a north-south distance). I will refer to them as the x-number and y-number respectively. Assume that the elements with a depth-value of one are the ones closest to the surface.
Every element in the three-dimensional array corresponds to a cubic volume in space, known as a voxel. The element will contain the number of barrels of oil in the voxel.
There are two parts of the program. The first part is reading in the positions of voxels that contain oil. Then the results of various drilling operations shall be reported.
A drilling operation will consist of starting at a given location on the ground and drilling through so many pixels. A drill will get all the oil in all the voxels it encounters (naturally) However, oil will flow as other oil is pumped out. In fact, it will flow any time two voxels both contain oil and they are next to each other including diagonally. These represent a pool of oil or oilfield--within such a field, oil flows freely.
The first job is to read in the location of oil in the ground. The data containing this is geology.in
For each voxel with oil, there will be four numbers. The first number will be the depth. The second and third numbers will be the x-number and y-number. The last number will be the quantity of oil in the given voxel, measured in barrels. The fourth number will be a real-number. A set of three zeros will indicate the end of the data in geology.in.
Any position in the volume (the three-d array) which doesn't have a line recorded in geology.in shall be assumed to have no oil.
After the geology.in file is read in, you will read tuples of numbers from the keyboard. Each tuple of numbers will be a depth of drilling
Then you will read in the location and depth for each drilling possibility. There will be three numbers for each one. The first number will be the depth. The second and third numbers will be x and y numbers where the drilling will start. For each such set of three numbers (3-tuple), print out the oil that will be gotten from the drilling.
For example, if geology.in contained:
5 4 4 10.0
5 4 5 10.0
5 5 4 10.0
6 4 4 10.0
2 4 4 5.1
7 3 3 10.0
10 4 4 20.0
7 1 1 10.0
7 1 2 20.0
0 0 0
If the three numbers read in were
7 4 4
the output would be 55.1
As oil would flow from 7,3,3 6,4,4 5,4,4 5,4,5 5,5,4 (one field) as well as the small field at 2,4,4.
If the three numbers read in were 3 4 4
the answer would be 5.1 as oil would only come from 2,4,4.
If the three numbers read in were 10 4 4 then the answer would now be 75.1 as additional oil would come in from 10,4,4
And lastly if the input were 7 1 1
the answer would be 30.0 as oil would flow from 7,1,1 and 7,1,2
ITEM C. LEVEL B ASSIGNMENTYou are to read in data about the purchases from a chain of stores in a file called IN.DATA. There are five stores, numbered one to five. Each store has ten departments, numbered one to ten. Let 000 be the sentinel in IN.DATA
For each purchase you should have the following information in IN.DATA :
1] The department number where the purchase was made. 2] The store number where the purchase was made. 3] The amount of purchase.Your output should be printed in a file called OUT.DATA. OUT.DATA should contain the following information:
1] The total purchases made for each store. 2] The total purchases made at each department. 3] The most profitable (largest sale) department.For instance, if IN.DATA were to contain the following data:
1
101
1000
2
201
2000
1
102
1000
2
202
2000
1
101
3000
000
Your OUT.DATA should have the following information :
1
101
4000
2
201
2000
1
102
1000
2
202
2000
1
5000
2
4000
1
5000
ITEM D. LEVEL B ACTIVITYYou are to read in data about temperature readings from cities for days during the month of January in a file called INPUT.DAT. Let -1 be the sentinel.
Each reading will have the following information:
1] A city number (from one to five) 2] An hour (from 0 to 23) (Using Military time) 3] The temperature in degrees FarenheitAt the end of the readings you are to print out the average temperature in each city and the average temperature by day for each city in a file called OUTPUT.DAT
CAREFUL -- There may be different numbers of readings for each city or day.
ITEM E. LEVEL A ACTIVITYYou are to read in login/logout data for students in Academic Computing Labs in a file called IN.DAT. For each student that enters the labs and uses the computer, the following data is to be stored in a file called OUT.DAT:
1] Login time (just the hour in military time). 2] Logout time (just the hour in military time). 3] Computer type used (a number from 1 to 4). 4] Lab used (a number from 1 to 12)You are to also read in an array of data giving maximum number of computers of each type in the lab.
Determine for each lab, what number of hours there is a waiting list for each computer type--i.e, all computers are in use.
ITEM F. LEVEL A ACTIVITYYou are to write a program to display slide shows of "abstract art" Each art slide will be represented as a two-dimensional array of numbers. These numbers will be the value for setcolor. These correspond to a collection of boxes that take up the entire screen.
The program will read in a file called ABSTRACT.IN. It will contain the number of slides. Then it will contain the number of rows and columns of colors.
Your program is to read all the data into a three-dimensional array. One dimension will represent the order of the slide.
The system should cycle through the pictures, five seconds per picture.
Assume that ABSTRACT.IN contained:
5
2 3
4 4 4
4 4 4
1 1 1
4 4 4
4 4 4
1 1 1
1 1 1
1 1 1
1 4 1
4 1 4
The system will display a screen that was all red for five seconds. Then it will display a screen that will be blue in the upper half and red in the upper half. Then it will display a screen that will be all blue for five seconds. Then it will be display a mixed screen as indicated in the last six numbers. Then the system will cycle back to the all-red screen at the beginning and continue.