1. Objective: calculate the distance in miles a ship at sea can see the lighthouse.
2. Requirements:
--INPUT
height (set by author or user)
--PROCESSING
distance = square root of 0.8 * height
--OUTPUT
objective
author
user instructions (if any)
label1 "A "
label2 " foot tall lighthouse can be seen from "
label3 " miles away."
height (unformatted)
distance (formatted to 0 digits past the decimal point and no decimal point)
--DATA
height-->>height of lighthouse in feet (integer)
distance-->>distance from the lighthouse in miles (decimal)
3. Algorithm Instructions
10 output objective
20 output author
30 output user instructions (if any)
40 height = set by author or user
50 distance = square root of 0.8 * height
60 output label1
70 output height
80 output label2
90 output distance formatted to 0 digits past the decimal point and no decimal point
100 output label3
110 END
4. Test Cases
Test Case#1: height=35. expected output is "A 100 foot tall lighthouse can be seen from 5 miles away."
10 the average age of 3 people
20 Author: Godfrey Udensi
30 height = 35
40 distance = 5.29
50 A
60 35
70 foot tall lighthouse can be seen from
80 miles away
90 35
100 5.29
MY CODE (DOESNT COMPILE)
//main program
int main()
{
// output my name and objective and program information
cout << "Objective: calculate the distance in miles a ship at sea can see the lighthouse.\n";
cout << "Programmer: Godfrey Udensi\n";
cout << "Editor(s) used: Notepad\n";
cout << "Compiler(s) used: VC++ 2010 Express\n";
cout << "File: " << __FILE__ << endl;
cout << "Complied: " << __DATE__ << " at " << __TIME__ << endl << endl;
//variables
int height = 35;
double distance = sqrt of 0.8 times height;
//output
cout << "A " << height << endl;
cout << " 35 foot tall lighthouse can be seen from << distance 9 << endl;
cout << "miles away. << endl;