Program:
The distance to the horizon increases as you climb a mountain (or a hill). The expression
π = √2πβ + β2
where
d = distance to the horizon, r = radius of the earth, and h = height of the hill.
can be used to calculate that distance The distance depends on how high the hill is and the radius of the earth (or another planetary body). Read the heights and print a table with columns: the planet number, mountain height (miles), and distance from the horizon (miles). Print the highest mountain on each planet at the end of the report.
|
mountainHeights.txt,
where
11 is the number of mountains for loop control when reading,
4 and 3 are planet ID numbers to determine where the mountain is, and the second column is the height of the mountains.
Note that
Earth’s diameter is 7926 miles. Mars’ diameter is 4217 miles.
Problem Constants:
filename
earth_diameter are 7926 miles mars_diameter is 4217 miles
Problem Inputs:
Problem Outputs:
Other variables:
Equations:
Algorithm:
% prepare file to read
% check if the file has been opened
% CONSTANT VALUES
% print table title and column headers
% read first value in file; number of mountains numMtn = fscanf(fileID, '%d', 1);
% read the values from data file using fscanf.
% compute distance from horizon
% print table with planet number and
% mountain height and distance from horizon in miles
% table footer
fprintf('* Units = miles\n\n')
% print highest mountain height for each planet
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme