Homework 4, Coding Mechanics.
Short Description:
Implement the following program. It must run on cslab103 when you are finished.
Goals
When you finish this homework, you should have:
- Executed the mechanical part of the coding process.
Formal Description
The following program is complete, syntactically correct and should work.
#include <iostream>
#include <iomanip>
using namespace std;
const float SAP_PER_SYRUP{40};
const float PINTS_PER_GALLONS{8};
int main() {
float sapAvailable;
float syrupMade;
float pintsOfSyrup;
cout << fixed << setprecision(2);
cout << "Enter the gallons of sap harvested today => ";
cin >> sapAvailable;
cout << endl;
syrupMade = sapAvailable / SAP_PER_SYRUP;
pintsOfSyrup = syrupMade * PINTS_PER_GALLONS;
cout << endl;
cout << "That made " << syrupMade << " gallons of syrup." << endl;
cout << "Or " << pintsOfSyrup << " pints of syrup." << endl;
return 0;
}
For this homework, you will make a working version of this code executable on cslab103. You may use whatever tools you wish, but you should use this assignment to make sure you can produce code in this environment.
- Start a word document somewhere you can take screen shots of the process. This is the last time you will do this for me.
- Using a text editor, create a text file containing the above code. Please call the file
maple.cpp
- In the word document tell me what text editor you are using to create this code.
- Take a screen shot of your text editor in action and place it in the word document.
- If you did not create the text file on cslab103, use a file transfer client to transfer your code from where you created it to cslab103.
- In the word document, tell me what file transfer client you used to transfer your file to cslab103.
- Take a screen shot of your file transfer client in action.
- Use a terminal emulator to connect to clsabl103
- Compile your code.
-
g++ -o maple maple.cpp
- In the word document, tell me what terminal emulator you are using.
- Take a screen shot of this and place it in your document.
- If the code compiles, continue, if not, find and fix any errors and repeat from step 3 until you have a program that will compile. (You do not need to add to the word document)
- Run your code
-
./maple
- Take a screen shot of this and place it in your document.
- Do this three times with an input of 40, 60 and 80.
- Did you get the expected results for these quantities of sap?
Required Files
A word document and a c++ file.
Submission
Submit the assignment to the D2L folder Homework 4 by the due date.