Homework 4, Coding Mechanics.

Short Description:

Implement the following program. It must run on cslab103 when you are finished.


When you finish this homework, you should have:

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.

  1. Start a word document somewhere you can take screen shots of the process. This is the last time you will do this for me.
  2. Using a text editor, create a text file containing the above code. Please call the file maple.cpp
    1. In the word document tell me what text editor you are using to create this code.
    2. Take a screen shot of your text editor in action and place it in the word document.
  3. 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.
    1. In the word document, tell me what file transfer client you used to transfer your file to cslab103.
    2. Take a screen shot of your file transfer client in action.
  4. Use a terminal emulator to connect to clsabl103
    1. Compile your code.
      1. g++ -o maple maple.cpp
      2. In the word document, tell me what terminal emulator you are using.
      3. Take a screen shot of this and place it in your document.
      4. 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)
    2. Run your code
      1. ./maple
      2. Take a screen shot of this and place it in your document.
      3. Do this three times with an input of 40, 60 and 80.
      4. Did you get the expected results for these quantities of sap?

Required Files

A word document and a c++ file.


Submit the assignment to the D2L folder Homework 4 by the due date.