Please send questions to
st10@humboldt.edu .
// Contract: main: void -> int
//
// Purpose: print to the screen the profits for ticket prices between
// $4 and $5, inclusive (or, [4.0, 5.0] ) in dime increments;
//
// Examples: not applicable; it simply prints these profits for these
// ticket prices to the screen.
//
// by: Sharon Tuttle
// last modified: 11-2-05
#include <iostream>
#include "profit.h"
using namespace std;
int main()
{
// declarations
double curr_ticket_price;
const double LOWEST_TICKET_PRICE = 2.0;
const double HIGHEST_TICKET_PRICE = 7.0;
const double PRICE_INCREMENT = 0.10;
// print headers
cout << endl
<< "Profits for ticket prices between $"
<< LOWEST_TICKET_PRICE
<< " and $"
<< HIGHEST_TICKET_PRICE
<< " (in dime increments)"
<< endl
<< "--------------------------------------------------------------"
<< endl;
cout << "ticket_price" << " " << "profit" << endl;
cout << "------------" << " " << "------" << endl;
// compute and print the profits for each ticket price between
// lowest and highest ticket prices of interest in .10 increments
// (initialize your loop control variable)
curr_ticket_price = LOWEST_TICKET_PRICE;
while (curr_ticket_price <= HIGHEST_TICKET_PRICE)
{
cout << "$" << curr_ticket_price << "\t\t"
<< "$" << profit(curr_ticket_price) << endl;
curr_ticket_price = curr_ticket_price + PRICE_INCREMENT;
}
return EXIT_SUCCESS;
}