logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

This project focuses on creating a 2D array of elevations representing a topographical map for a fictional island

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Students:

This content is controlled by your instructor, and is not zyBooks content. Direct questions or concerns about this content to your instructor. If you have any technical issues with the zyLab submission system, use the Trouble with lab button at the bottom of the lab.

  • LAB*: Creating an Elevation Map

The Topography of Innovation Island

This project focuses on creating a 2D array of elevations representing a topographical map for a fictional island:

[Click here if you cannot see the above image of the elevation map.]

The island is a perfect rectangle 19 squares wide and 15 squares high, where the outer squares all have elevation 0.0, representing the ocean. The island terrain is composed of 5 hills (shown as red Xs on the map):

Hill Name Ada's Apex

Location of Peak (x,y) (12, 9)

Height 20.0

Steepness (or Slope) 0.25

Turing's Top

(4, 3)

20.0

0.33

Hill Name

Location of Peak (x,y)

Height

Steepness (or Slope)

Babbage's Bluff

(6, 13)

15.0

0.33

Hopper's Hill

(14, 2)

15.0

0.5

Katherine's Cliff

(1, 9)

10.0

0.5

Note: the 5 hills are named after 5 computationally-focused innovators, namely Ada Lovelace ("World's First Programmer"), Alan Turing ("Father of Computer Science"), Charles Babbage ("Father of the Computer"), Grace Hopper ("Early Pioneer of Programming"), and Katherine Johnson (NASA mathematician who pioneered the use of computers for complicated scientific and engineering calculations and was portrayed as a lead character in the recent Hidden Figures movie, which highlighted the important work of black female mathematicians at NASA that too often gets overlooked). I encourage you to read about all of their stories. Wikipedia is a good place to start.

The elevation at any (x, y) location on the island can be calculated by modeling each hill as a

Gaussian Bump and summing up the contributions from all 5 hills as follows:

[Click here if you cannot see the image of the elevation equation.]

where xi, yi, hi, and si are the (x, y) locations, heights, and steepnesses for each of the 5 hills given in the table above.

Programing Tasks

Some of the tasks require general, proper functionality of a user-defined function and struct data type. Some of the test cases involve unit testing of your function, independent of your calls from main(). For this project, organize all code in one file, namely main.c.

  1. Define a struct data type titled Hill that has the following subitems:

a char array of length 20 titled name, which stores the name of the hill.

an int array of length 2 titled loc, which stores the (x, y) coordinates, in order, for the location of the peak of the hill.

a double variable titled height, which stores the height of the hill.

a double variable titled slope, which stores the steepness parameter for the hill.

  1. Write the setHill() function, which should create, assign all subitems, and return a brand new Hill type variable based on the following inputs to the function (specifically in this order):

a char array of length 20 representing the name of the hill.

an int variable representing the x-location of the hill. an int variable representing the y-location of the hill. a double variable representing the height of the hill. a double variable representing the slope of the hill.

  1. In main(), create and fill a Hill array of length 5 to store all of the data from the table above for the 5 hills on Innovation Do this by calling your setHill() function for each of the 5 hills. Of course, this requires the Hill struct to be properly defined.

  2. In main(), define a 19x15 2D array to store elevations for Innovation Then, assign values to the array by calculating the elevation at each (x, y) location based on the summation formula above. You only need to consider integer x-values from 0-18 and integer y-values from 0-14, thus the 19x15 array of elevations. Make sure to sum up the elevation contribution from each of the 5 hills. Also, make sure to set all outer edges of the array to zero, representing the ocean. [It is important to realize that you are adding elevation at all (x, y) locations due to all 5 hills. So, the total elevation at the location of a hill peak will actually be greater than the height of that hill alone. For example, Hopper's Hill has a height of 15.0, but the total elevation at (14, 2) is 15.7288 with the extra 0.7288 due to contributions from the other 4 hills.]

  3. Print out the 2D array of elevations for Innovation See the sample output below for the proper format. There are two key features:

the array should be printed in the same orientation as the map above, with the (0,

0) point in the lower left corner.

the format specifier "%4.1f " should be used to allocate 4 total characters for each floating-point value to 1 decimal place, followed by an additional space before the next value is printed.

  1. Finally, in main(), let the user input an (x, y) location, and report back the elevation at that Do this by reading in two integers from the user. See the sample output below for proper formatting of the print statement of the elevation at the user's location. Additionally, let the user know whether or not their location is the peak of one of the hills. If so, let the user know which hill they are at the peak of. Again, make sure to properly format the output statements following the sample output given below. Finally, report the direction (North, East, South, or West) that a hiker should walk from the user- inputted (x,y) location with the least elevation change. That is, compare the squares directly adjacent and find the one with the minimal absolute difference in elevation from the user-inputted (x,y) location.

Sample Output

Here is a complete sample output from the code, where the user has entered their location as (12, 9):

Elevations for

Innovation Island:

 

0.0  0.0  0.0

0.0  0.0  0.0  0.0

0.0

0.0

0.0

0.0

0.0

0.0

 

0.0

1.2

2.8

5.7

9.9

13.8

15.8

15.0

12.4

9.8

8.4

7.9

7.7

7.0

5.7

4.2

2.7

1.5

0.0

 

 

 

 

 

 

 

0.0

1.9

3.2

5.5

9.0

12.6

14.7

14.5

12.9

11.5

11.2

11.6

11.7

10.8

8.9

6.5

4.2

2.4

0.0

 

 

 

 

 

 

 

0.0

4.3

4.6

5.1

7.0

9.5

11.4

12.0

12.0

12.5

13.8

15.3

15.8

14.7

12.1

8.9

5.7

3.3

0.0

 

 

 

 

 

 

 

0.0

8.2

7.1

5.2

4.9

6.2

7.7

9.0

10.6

12.8

15.6

18.0

18.9

17.7

14.6

10.7

6.9

3.9

0.0

 

 

 

 

 

 

 

0.0

10.3

8.5

5.1

3.5

3.8

5.0

6.7

9.1

12.4

16.0

19.0

20.1

18.8

15.6

11.4

7.4

4.2

0.0

 

 

 

 

 

 

 

0.0

8.4

7.1

4.5

3.1

3.1

3.8

5.3

7.8

11.2

14.8

17.7

18.8

17.7

14.6

10.7

6.9

3.9

0.0

 

 

 

 

 

 

 

0.0

5.0

5.2

4.7

4.4

4.2

4.2

4.8

6.5

9.2

12.3

14.7

15.6

14.7

12.2

8.9

5.7

3.3

0.0

 

 

 

 

 

 

 

0.0

3.9

5.7

7.2

7.9

7.3

6.1

5.3

5.6

7.0

9.0

10.8

11.5

10.9

9.1

6.7

4.3

2.4

0.0

 

 

 

 

 

 

 

0.0

5.0

8.5

11.7

13.1

12.0

9.2

6.4

5.0

5.1

6.0

7.1

8.0

8.1

7.3

5.4

3.3

1.7

0.0

 

 

 

 

 

 

 

0.0

6.8

11.6

16.1

18.0

16.3

12.0

7.6

4.7

3.6

3.7

4.6

6.2

8.2

8.8

6.7

3.6

1.5

0.0

 

 

 

 

 

 

 

0.0

7.5

12.9

18.0

20.0

18.0

13.2

7.9

4.3

2.5

2.3

3.3

6.4

11.1

13.3

10.3

5.1

1.7

0.0

 

 

 

 

 

 

 

0.0

6.7

11.6

16.1

18.0

16.1

11.7

6.9

3.5

1.7

1.4

2.5

6.5

12.6

15.7

12.2

5.9

1.8

0.0

 

 

 

 

 

 

 

0.0

4.9

8.4

11.6

12.9

11.6

8.4

4.9

2.4

1.1

0.8

1.6

4.7

9.4 12.0

9.3

4.4

1.3

0.0

 

 

 

 

 

 

 

0.0  0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0  0.0

0.0

0.0

0.0

0.0

 

 

 

 

 

 

 

Enter your x-location (1-17): 12

Enter your y-location (1-13): 9

The elevation for the point (12,9) is 20.0525 You are at the peak of Ada's Apex!

Walk West for a moderate hike. The elevation change is -1.0897

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

715 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

571 Answers

Hire Me
expert
Husnain SaeedComputer science

824 Answers

Hire Me
expert
Atharva PatilComputer science

681 Answers

Hire Me
July
January
February
March
April
May
June
July
August
September
October
November
December
2025
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
SunMonTueWedThuFriSat
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30