Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Overview Write a C program that detects and reports on areas of brightness in the night sky. You will input a portion of the

1 Overview

Write a C program that detects and reports on areas of brightness in the night sky. You will input a portion of the night sky (from standard input) represented by an n n grid of integers where n

You should preprocess your data to eliminate noise in following manner: for every negative value you encounter, average the (maximum of) 8 squares around it and replace the value with the average (rounded off to the nearest whole number; use nearbyint frommath.h). If one of the surrounding squares also is negative, use the value of 0 in computing the average.

Your input will consist of a single integer s representing the size of the grid followed by s s data values. Your output should be presented exactly like the sample run (using your name, of course, instead of mine). You also must use functions to input your data into an array, to preprocess your array, and one to find and report the bright spots. In other words you should have at least 3 separate functions defined that each are passed your two-dimensional data array where one function only inputs the array, one function onlypreprocesses the data to eliminate noise, and one function only finds and reports the bright spots. These functions must all be called from main. You must define your array local to your main function and pass it into all functions that need it. You may not declare and use any global data (other than possibly preprocessor definitions to define the maximum size of the sky and debugging flags if used).

2 Sample Run

Data file:

20

0 0 0 0 0 0 0 13 18 18 15 5 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 6 16 19 16 6 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 12 16 18 17 5 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 12 14 12 14 9 0 0 0 0 0 0 0 0

00000000000000000000

00000000000000000000

00000000000000000000

0 0 0 0 0 0 0 0 0 8 10 4 6 10 0 0 0 0 0 0

0 0 0 0 3 3 5 3 -2 10 12 11 11 6 0 0 0 0 0 0

0 0 0 0 5 6 6 6 5 7 13 14 13 4 0 0 0 0 0 0

0 0 0 0 2 7 8 6 4 8 12 13 11 9 0 0 0 0 0 0

0 0 0 0 2 7 7 7 5 9 4 10 6 4 0 0 0 -2 0 0

00004434366450000000

00000000688750000000

00000000579860000000

00000000577830000000

00000000354440000000

00003330000000000000

0 0 0 -1 -1 -2 8 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 -1 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Sample run using above data:

The answer should be the same as the samble run.

image text in transcribed

Terminal -tcsh 49x 17 liberty Cprogs/% gcc brightest.c liberty Cprogs a.out brightest4. dat Project #6; Dan Resler Grid size 20x20 Bright spots: 9,111 14 110, 6 8 8, 9 10 L 9, 101 13 110,111 13 [11,11] 10 114, 10] 9 liberty cprogs/96

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

Question in Chemical Engineering Please give Correct Answer 1 3 .

Answered: 1 week ago

Question

=+ Does the job incumbent work outside or in an office setting?

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago