All chapter download Absolute C++ 6th Edition Savitch Solutions Manual

kaysszakov 93 views 48 slides Feb 22, 2025
Slide 1
Slide 1 of 48
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48

About This Presentation

All chapter download Absolute C++ 6th Edition Savitch Solutions Manual


Slide Content

Visit https://testbankfan.com to download the full version and
explore more testbank or solutions manual
Absolute C++ 6th Edition Savitch Solutions Manual
_____ Click the link below to download _____
https://testbankfan.com/product/absolute-c-6th-edition-
savitch-solutions-manual/
Explore and download more testbank or solutions manual at testbankfan.com

Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Absolute C++ 6th Edition Savitch Test Bank
https://testbankfan.com/product/absolute-c-6th-edition-savitch-test-
bank/
Absolute C++ 5th Edition Savitch Solutions Manual
https://testbankfan.com/product/absolute-c-5th-edition-savitch-
solutions-manual/
Absolute C++ 5th Edition Savitch Test Bank
https://testbankfan.com/product/absolute-c-5th-edition-savitch-test-
bank/
Absolute Java 6th Edition Savitch Test Bank
https://testbankfan.com/product/absolute-java-6th-edition-savitch-
test-bank/

Absolute Java 5th Edition Walter Savitch Solutions Manual
https://testbankfan.com/product/absolute-java-5th-edition-walter-
savitch-solutions-manual/
Absolute Java 5th Edition Walter Savitch Test Bank
https://testbankfan.com/product/absolute-java-5th-edition-walter-
savitch-test-bank/
Problem Solving with C++ 10th Edition Savitch Solutions
Manual
https://testbankfan.com/product/problem-solving-with-c-10th-edition-
savitch-solutions-manual/
Problem Solving with C++ 9th Edition Savitch Solutions
Manual
https://testbankfan.com/product/problem-solving-with-c-9th-edition-
savitch-solutions-manual/
Problem Solving with C++ 9th Edition Savitch Test Bank
https://testbankfan.com/product/problem-solving-with-c-9th-edition-
savitch-test-bank/

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
Chapter 6
Structures and Classes
Key Terms
structure
struct
structure tag
member name
where to place a structure definition
structure value
member value
member variable
reusing member names
structure variables in assignment statements
structure arguments
functions can return structures
class
object
member function
calling member functions
defining member functions
scope resolution operator
type qualifier
member variables in function definitions
data types and abstract types
encapsulation
private:
private member variable
public:
public member variable
accessor function
mutator function
interface
API
implementation
Brief Outline
6.1 Structures
Structure Types
Structures as Function Arguments
Initializing Structures
6.2 Classes
Defining Classes and Member Functions
Encapsulation
Public and Private Members

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
Accessor and Mutator Functions
Structures versus Classes
1. Introduction and Teaching Suggestions
In earlier chapters, we saw the array, the first of the C++ tools for creating data structures. The
other tools are the struct and the class. We saw that the array provides a homogeneous,
random access data structure. This chapter introduces tools to create heterogenous data
structures, namely the struct and class. While the struct and class are identical except for default
access, the text takes the didactic approach of first ignoring struct function members. This
chapter deals with the struct as C treats it. The text then develops the simpler ideas involved in
declaration and access for the struct. Then the machinery of class creation, protection
mechanisms and some ideas of encapsulation of functions with data are treated. Constructors are
left to Chapter 7.
2. Key Points
Structures and Structure Types.Historical note: The name struct in C++ is provided
primarily for backward compatibility with ANSI C. Suppose we declare a struct, as in:
struct B
{
int x;
int y;
};
The text points out that the identifier B is called the structure tag. The structure tag B carries full
type information. The tag B can be used as you would use any built-in type. The identifiers x and
y declared in the definition of struct B are called member names. The members are variables are
associated with any variable of struct type. You can declare a variable of type B by writing
1
B u;
You can access member variables (as l-values) by writing
u.x = 1;
u.y = 2;
or (as r-values)
int p, q;
p = u.x;
q = u.y;
We said in the previous paragraph that the tag B can be used as you would use any built-in type.
You can pass a struct to a function as a parameter, use a struct as a function return type, and
declare arrays of variables of type struct.
1
Contrast this with the C usage, struct B u;, where the keyword struct must be used in the definition of a
structure variable. This use is permitted in C++ for backward compatibility with C.

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
Our author points out that two identifiers that are declared to be of the same structure type may be
assigned, with member-wise assignment occurring.
2
The critical issue here is that for assignment
compatibility the two structure variables must be declared with the same structure tag. In the
example that follows, the types are indistinguishable from the member structure within the struct.
However, C++ uses name equivalence for types, so the compiler looks at the tags in the
declarations rather than the structure to determine whether one struct variable may be assigned to
another. Example:
struct A
{
int x;
int y;
};
struct B
{
int x;
int y;
};
A u;
B v;
u = v; //type error: u and v are of different types
The error message from g++ 2.9.5 is:
// no match for 'A& = B&'
// candidates are: struct A& A::operator=(const A&)
Structures as Function Arguments.Since a structure tag is a type, the tag can be used as any other
type would be used. You can have arrays of structure objects, or function parameters that are call-by-value
or call-by-reference, and you can use a structure a type for the return type of a function.
Defining Classes and Member Functions. These remarks elaborate the ideas in the text on
class and the scope resolution operator, ::. A class definition (and a struct definition as well),
with the {}; define a scope within which variables and functions are defined. They are not
accessible outside without qualification by the object name and a dot operator . Member
functions are defined within a particular class, to be used by any object declared to be of that
class, again, only with qualification by being preceded by the object name and the dot operator.
To define a function whose prototype is given in a class we have to specify the scope of that
class within which the function is being defined. This is done with the class tag and scope
resolution operator.
To say:
returnTypeName class_tag::funcMemberName(argumentList)
{
//memberFunctionBody...
}
is to say "Within the scope of the class class_tag, define the function named funcMemberName
that has return type returnTypeName."
2
Member-wise assignment is the default for classes and structs. A former student of mine, John Gibson coined the
phrase, “Member UNWISE copy”. We will see that for classes with pointer members, member (un)wise copy is
almost never what you want.

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
The data members belong to a particular object, and function members must be called on behalf
of that particular object. The object must be specified. The object is specified by using the dot
operator used after the object name, before the member name or function call. Sometimes we
may speak of the calling object.
Encapsulation. The notion of encapsulation means, “to collect together, as if to place in a
capsule”, from which we may infer the purpose, “to hide the details”. The text says a data type
has a set of values to be manipulated, and sets of operations to manipulate the values, but the
details are available to the user or client. A data type becomes an abstract data type if the client
does not have access to the implementation details.
Abstract Data Types. The notion of Abstract Data Type (ADT) has two players: the author of
the ADT and the client of the ADT. The client knows only what the ADT will do, not how the
ADT carries out its tasks. The author of the ADT knows only what the ADT will do for the
client, but nothing about the context within which the ADT is used by the client. Information
hiding is a two way hiding. The separation of implementation (known only to the class author)
and the interface (the contract between ADT author and client) is vital. The other side of the
coin, namely the concealment from the ADT author of the context within which the ADT will be
used, is equally vital. This prevents either author from writing code that would depend on the
internals written by the other programmer.
Separate compilation is necessary to a) concealing implementation details and b) assigning tasks
to several programmers in a team. The reason for leaving the interface and the implementation of
the ADTs in the client in the text is that we do not yet know anything about separate compilation.
Observe that the text almost always places declarations (prototypes) prior to use, then uses the
functions in the main function, then tucks the definitions away after the main function. This has
the effect of emphasizing separation of definition and declaration well before separate
compilation is seen by the student. This is worth mentioning to the student.
Public and Private Members. The data members of a class are part of the implementation, not
part of the interface. The function members intended for use by the client are the interface. There
may be helping functions for the implementation that would be inappropriate for the client to
use, and so are not part of the interface. Normally the interface is made available to the client and
the implementation is hidden.
A struct, by default, allows access to its members by any function. A class, by default, allows
access to its members only to those functions declared within the class. This default access in a
struct is called public, and the default access in a class is called private.
The keywords private and public help manage hiding the implementation and making the
interface available to the client. These keywords are used to modify the default access to
members of a class or struct. The keyword private is used to hide members. The effect of the
keyword private: extends from the keyword private: to the next instance of the keyword public:.
The effect of the keyword public: extends from the keyword public: up to the next instance of the
keyword private:.

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
Accessor and Mutator Functions. It is the class author who writes the accessor and mutator
functions, so it is she who controls the access to the class data. If the data members were public,
any function has access in any way the client wishes. Data integrity will be compromised.
Structures versus Classes. This is the text’s “truth in advertising” section. Since this document
is for the instructor, little distinction between structs and classes is made here.
3. Tips
Hierarchical Structures. It is worth pointing out that the name spaces for hierarchical (or
nested) structures are separate. The same names can be used in the containing struct as are used
in the structure member. The same names can be used in two structures members at the same
level.
Example: Name space and hierarchical structure initialization
// file: ch6test2.cc
// purpose: test namespace in hierarchical structures
#include <iostream>
using namespace std;
struct A
{
int a;
int b;
};
struct B
{
A c;
int a;
int b;
};
int main()
{
A u = {1,2};
B v = {{3,4},4,5};
cout << "u.a = " << u.a << " u.b = " << u.b << endl;
cout << "v.c.a = " << v.c.a << " v.c.b = " << v.c.b
<< " v.a = " << v.a << " v.b = " << v.b << endl;
return 0;
}
This code compiles and runs as expected. The output is:
u.a = 1 u.b = 2
v.c.a = 3 v.c.b = 4 v.a = 4 v.b = 5
This is, of course, a "horrible example", designed to show a worst case. One would almost never
use the same identifiers in two structures while using a struct object as a member of another as
we do here. However, this does serve to illustrate the idea that the name spaces for two structures
are separate. (This is also true for classes as well.) In short, duplicating a member name where
needed won't break a program.
Initializing Structures. The previous example also illustrates that structure variables can be
assigned initial values using the curly brace notation.

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
Separate Interface and Implementation. The interface provides the API and helps abstract the
implementation details from a user of the class. This allows a programmer to change the
implementation without having to change other parts of the program.
A Test for Encapsulation. If you can change the implementation of a class without requiring a
change to the client code, you have the implementation adequately encapsulated.
Thinking Objects. When programming with classes, data rather than algorithms takes center
stage. The difference is in the point of view compared to students that have never programmed
with objects before.
4. Pitfalls
Omitting the semicolon at the end of a struct or class definition. The text points out that a
structure definition is required to have a semicolon following the closing curly brace. The reason
is that it is possible to define a variable of the struct type by putting the identifier between the
closed curly brace, }, and the semicolon.
struct A
{
int a;
int b;
} c;
The variable c is of struct type A. With some compilers, this pitfall generates particularly
uninformative error messages. It will be quite helpful for the student to write several examples in
which the closing semicolon in a structure definition is deliberately omitted.
5. Programming Projects Answers
1. Class grading program
//ch6Prg1.cpp
#include <iostream>
using namespace std;
const int CLASS_SIZE = 5;
// Problem says this is for a class, rather than one student.
// Strategy: Attack for a single student, then do for an array of N
// students.
//Grading Program
//Policies:
//
// Two quizzes, 10 points each
// midterm and final exam, 100 points each
// Of grade, final counts 50%, midterm 25%, quizes25%
//
// Letter Grade is assigned:

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
// 90 or more A
// 80 or more B
// 70 or more C
// 60 or more D
// less than 60, F
//
// Read a student's scores,
// output record: scores + numeric average + assigned letter grade
//
// Use a struct to contain student record.
struct StudentRecord
{
int studentNumber;
double quiz1;
double quiz2;
double midterm;
double final;
double average;
char grade;
};
//prompts for input for one student, sets the
//structure variable members.
void input(StudentRecord& student);
//calculates the numeric average and letter grade.
void computeGrade(StudentRecord& student);
//outputs the student record.
void output(const StudentRecord student);
int main()
{
StudentRecord student[CLASS_SIZE];
for(int i = 0; i < CLASS_SIZE; i++)
input(student[i]);
// Enclosing block fixes VC++ "for" loop control defined outside loop
{ for(int i = 0; i < CLASS_SIZE; i++)
{
computeGrade(student[i]);
output(student[i]);
cout << endl;
}
}
return 0;
}
void input(StudentRecord &student)
{
cout << "enter the student number: ";
cin >> student.studentNumber;
cout << student.studentNumber << endl;
cout << "enter two 10 point quizes" << endl;
cin >> student.quiz1 >> student.quiz2;

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
cout << student.quiz1 << " " << student.quiz2 << endl;
cout << "enter the midterm and final exam grades."
<< "These are 100 point tests\n";
cin >> student.midterm >> student.final;
cout << student.midterm << " " << student.final
<< endl << endl;
}
void computeGrade(StudentRecord& student)
{
// Of grade, final counts 50%, midterm 25%, quizes25%
double quizAvg= (student.quiz1 + student.quiz2)/2.0;
double quizAvgNormalized = quizAvg * 10;
student.average = student.final * 0.5 +
student.midterm * 0.25 +
quizAvgNormalized * 0.25;
char letterGrade[]= "FFFFFFDCBAA";
int index = static_cast<int>(student.average/10);
if(index < 0 || 10 <= index)
{
cout << "Bad numeric grade encountered: "
<< student.average << endl
<< " Aborting.\n";
abort();
}
student.grade = letterGrade[index];
}
void output(const StudentRecord student)
{
cout << "The record for student number: "
<< student.studentNumber << endl
<< "The quiz grades are: "
<< student.quiz1 << " " << student.quiz2
<< endl
<< "The midterm and exam grades are: "
<< student.midterm << " " << student.final
<< endl
<< "The numeric average is: " << student.average
<< endl
<< "and the letter grade assigned is "
<< student.grade
<< endl;
}
Data for the test run:
1 7 10 90 95
2 9 8 90 80
3 7 8 70 80
4 5 8 50 70
5 4 0 40 35
Command line command to execute the text run:

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
ch6prg1 < data
Output:
enter the student number: 1
enter two 10 point quizes
7 10
enter the midterm and final exam grades. These are 100 point tests
90 95
enter the student number: 2
enter two 10 point quizes
9 8
enter the midterm and final exam grades. These are 100 point tests
90 80
enter the student number: 3
enter two 10 point quizes
7 8
enter the midterm and final exam grades. These are 100 point tests
70 80
enter the student number: 4
enter two 10 point quizes
5 8
enter the midterm and final exam grades. These are 100 point tests
50 70
enter the student number: 5
enter two 10 point quizes
4 0
enter the midterm and final exam grades. These are 100 point tests
40 35
The record for student number: 1
The quiz grades are: 7 10
The midterm and exam grades are: 90 95
The numeric average is: 91.25
and the letter grade assigned is A
The record for student number: 2
The quiz grades are: 9 8
The midterm and exam grades are: 90 80
The numeric average is: 83.75
and the letter grade assigned is B
The record for student number: 3
The quiz grades are: 7 8
The midterm and exam grades are: 70 80
The numeric average is: 76.25
and the letter grade assigned is C
The record for student number: 4
The quiz grades are: 5 8
The midterm and exam grades are: 50 70
The numeric average is: 63.75
and the letter grade assigned is D

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
The record for student number: 5
The quiz grades are: 4 0
The midterm and exam grades are: 40 35
The numeric average is: 32.5
and the letter grade assigned is F
*/
2. CounterType
An object of CounterType is used to count things, so it records a count that is a nonnegative
integer number. It has mutators to increment by 1 and decrement by 1, but no member allows the
counter value to go negative.
There is an accessor that returns the count value, and a display function that displays the count
value on the screen.
Apropos of confusing error messages, this one is worth comment. In compiling the code for this
problem, the following warning message was generated from VC++6.0 on the last line of the
following code fragment:
warning: integral size mismatch in argument; conversion supplied
cout << "starting at counter value "
<< localCounter.currentCount
<< "and decrementing "
<< MAX << " times only decrements to zero.\n\n";
If the error message had been on the offending line, it would have been trivial to see the missing
parentheses on the second line of this code fragment. Warn the students that the error message
may be given several lines after the offending bit of code.
//Ch6prg2.cpp
//CounterType
//
// The class keeps a non-negative integer value.
// It has 2 mutators one increments by 1 and
// the other decrements by 1.
// No member function is allowed to drive the value of the counter
// to become negative. (How to do this is not specified.)
// It has an accessor that returns the count value,
// and a display member that write the current count value
// to the screen.
#include <iostream>
using namespace std;
const int MAX = 20;
class CounterType
{
public:
void InitializeCounter();
void increment();
//ignore request to decrement if count is zero

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
void decrement();
int currentCount();
void display();
private:
int count;
};
int main()
{
CounterType localCounter;
localCounter.InitializeCounter();
{
for(int i = 1; i < MAX; i++)
if(i%3 == 0) // true when i is divisible by 3
localCounter.increment();
}
cout << "There are " << localCounter.currentCount()
<< " numbers between 1 and " << MAX << " that are divisible by 3.\n\n";
cout << "Starting at counter value "
<< localCounter.currentCount(
<< " and decrementing "
<< MAX << " times only decrements to zero.\n\n";
{
for(int i = 1; i < MAX; i++)
{
localCounter.display();
cout << " ";
localCounter.decrement();
}
}
cout << endl << endl;
return 0;
}
void CounterType::InitializeCounter()
{
count = 0;
}
void CounterType::increment()
{
count++;
}
void CounterType::decrement()
{
if(count > 0) count--;
}

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
void CounterType::display()
{
cout << count;
}
int CounterType::currentCount()
{
return count;
}
A run gives this output:
There are 6 numbers between
1 and 20 that are divisible by 3.
Starting at counter value 6 and decrementing 20
times only decrements to zero.
6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
3. A Point class
A point in the plane requires two coordinates. We could choose from many coordinate systems.
The two that are most familiar are rectangular and polar. We choose rectangular coordinates (two
double values representing distances from the point in question to perpendicular coordinates).
Conversion the internal representation of this class from rectangular to polar coordinates
should be an excellent problem for students who are reasonably prepared.
These members should be implemented:
a)a member function, set, to set the private data after creation
b)a member function to move the point a vertical distance and a horizontal distance
specified by the first and second arguments.
c)a member function that rotates the point 90 degrees clockwise about the origin.
d)two const inspector functions to retrieve the current coordinates of the point.
Document the member functions.
Test with several points exercise member functions.
//Ch6prg3.cpp
#include <iostream>
using namespace std;
// Point
// The members should implement
// a)a member function, set, to set the private data after creation
// b)a member function to move the point a vertical distance and a
// horizontal distance specified by the first and second arguments.
// c)a member function that rotates the point 90 degrees clockwise
// about the origin.
// d)two const inspector functions to retrieve the current coordinates
// of the point.
// Document the member functions.
// Test with several points exercise member functions.

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
class Point
{
public:
//set: set x to first, y to second
void set(int first, int second);
//move point horizontally by distance first
//move vertically by distance second
void move(int first, int second);
//rotate point 90 degrees clockwise
void rotate();
// returns the first coordinate of the point
double first();
// returns the second coordinate of the point
double second();
private:
double x;
double y;
};
double Point::first()
{
return x;
}
double Point::second()
{
return y;
}
void Point::set(int first, int second)
{
x = first;
y = second;
}
void Point::move(int first, int second)
{
x = x + first;
y = y + second;
}
void Point::rotate()
{
double tmp = x;
x = -y;
y = tmp;
}
int main()
{
Point A, B, C;
A.set(1,2);
cout << A.first() << ", " << A.second() << endl;

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
A.rotate();
cout << A.first() << ", " << A.second() << endl;
A.rotate();
cout << A.first() << ", " << A.second() << endl;
A.rotate();
cout << A.first() << ", " << A.second() << endl;
A.rotate();
cout << A.first() << ", " << A.second() << endl;
A.rotate();
cout << A.first() << ", " << A.second() << endl;
B.set(2,3);
cout << B.first() << ", " << B.second() << endl;
B.move(1,1);
cout << B.first() << ", " << B.second() << endl;
C.set(5, -4);
cout << C.first() << ", " << C.second() << endl;
cout << "Move C by -5 horizontally and 4 vertically. " << endl;
C.move(-5, 4);
cout << C.first() << ", " << C.second() << endl;
return 0;
}
In this execution of the program: We start with (1,2). This point is rotated 90 degrees, four times,
getting back to the original point. The point (3,4) is set and moved by (1,1), that is, one up, one
right). A second point, (5,-4) is set and moved by (-5,4) one left, on down. Then we move it back
to the origin, (0,0). The output from this run is:
1, 2
-2, 1
-1, -2
2, -1
1, 2
-2, 1
2, 3
3, 4
5, -4
Move C by -5 horizontally and 4 vertically.
0, 0
4. A Gas Pump Simulation
The model should have member functions that
a)display the amount dispensed
b)display the amount charged for the amount dispensed
c)display the cost per gallon
d)reset amount dispensed and amount charged to 0 prior to dispensing
e)dispense fuel. Once started the gas pump continues to dispense fuel, continually keeping
track of both amount of money charged and amount of fuel dispensed until stopped.
f)a control to stop dispensing.
The implementation was carried out as follows:

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
1)Implement a class definition that models of the behavior of the gas pump.
2)Write implementations of the member functions.
3)Decide whether there are other data the pump must keep track of that the user should not
have access to.
Parts a) b) c) d) are straightforward to implement. Part e), the pumping operation is a little tricky.
Once I realized that the valve on the nozzle must be held to continue to dispense gas, I decided to
model that behavior by repeatedly pressing <CR> is an easy step. Tweaking the appearance and
behavior detail is all that was left. The tweaking was not trivial.
There are notes in the GasPump class definition that are addressed to the instructor. These
concern members that should be declared static or should have been members of a manager class
that is a friend of this class. The student is not likely to understand these notes. I suggest that you
delete these remarks if you give this solution to the student.
#include <iostream>
using namespace std;
class GasPump
{
public:
void initialize(); // set charges, amount dispensed, and
//gasInMainTank to 0.
void reset(); // set charges and amount dispensed to 0;
void displayCostPerGallon();
//If there is only one grade, of gasoline, this should be a static
//member of GasPump, since it would then apply to all instances of
//GasPump. If there are several grades, then this and costPerGallon
//should be ordinary members.
void displayGasNCharges();
// Dispense member continually updates display of new amount and
// new charges
void dispense();
void stop(); // If called, stops dispensing operation.
// My implementation never used this.
private:
double gasDispensed;
double charge;
public:
//Perhaps these functions should be static members of this class.
//See the earlier comment about this.
void setPricePerGallon(double newPrice);
void buyFromJobber(double quantity);
void displayAmountInMainTank();
private:
//These variables should be static members, since
//they are associated with all class instances.

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
double gasInMainTank;
double costPerGallon;
};
void GasPump::displayAmountInMainTank()
{
cout << gasInMainTank;
}
void GasPump::setPricePerGallon(double newPrice)
{
costPerGallon = newPrice;
}
void GasPump::buyFromJobber(double quantityBought)
{
gasInMainTank += quantityBought;
}
void GasPump::initialize()
{
gasDispensed = 0;
charge = 0;
gasInMainTank = 0;
}
void GasPump::reset()
{
gasDispensed = 0;
charge = 0;
}
void GasPump::displayCostPerGallon()
{
cout << costPerGallon;
}
void GasPump::displayGasNCharges()
{
cout << "gallons: " << gasDispensed
<< " $" << charge << endl;
}
void GasPump::dispense()
{
char quit;
system("cls"); // Windows clear screen
//system("clear"); // Unix/Linux
cout << "\n\nDISPENSING FUEL\n";
displayGasNCharges();
cout << "\nPress <CR> to dispense in 0.1 gallon increments. "
<< "\nPress q or Q <CR>to terminate dispensing.\n";
while(gasInMainTank > 0)
{

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
quit = cin.get();
if (quit == 'q' || quit == 'Q')
break;
charge += 0.1 * costPerGallon;
gasDispensed += 0.1;
gasInMainTank -= 0.1;
system("cls"); // Windows clear screen
//system("clear"); // Unix/Linux
cout << "\n\nDISPENSING FUEL\n";
displayGasNCharges();
cout << "\nPress <CR> to dispense in 0.1 gallon increments. "
<< "\nPress q or Q <CR>to terminate dispensing.\n";
}
if(0 == gasInMainTank)
cout << "Dispensing ceased because main tank is empty.\n";
}
int main()
{
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
GasPump pump;
char ans;
cout << "Gas Pump Modeling Program\n";
pump.initialize();
pump.setPricePerGallon(1.50);
pump.buyFromJobber(25);
cout << "Amount of gasoline in main tank is: ";
pump.displayAmountInMainTank();
cout << endl;
cout << "Gasoline price is $";
pump.displayCostPerGallon();
cout << " per gallon.\n";
pump.displayGasNCharges();
cout << "Press Y/y <CR> to run the dispensing model,"
<< " anything else quits. \n";
cin >> ans;
if( !('Y' == ans || 'y' == ans) )
return 0;
system("cls"); // Windows
//system("clear"); // Unix/Linux
cout << "\nWelcome Customer #1\n";
cout << "Press Y/y <CR> to start dispensing Fuel,”
<< “ other quits \n";
cin >> ans;

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
if('Y'==ans || 'y' == ans)
{
ans = cin.get(); // eat <cr>
pump.dispense();
}
cout << "Thank you. Your charges are:\n" ;
pump.displayGasNCharges();
cout << endl;
cout << "\n\nAmount of gasoline remaining in main tank is: ";
pump.displayAmountInMainTank();
cout << " gallons\n";
cout << "\n\nWelcome Customer #2\n";
pump.displayGasNCharges();
cout << "Press Y/y <CR> to start dispensing Fuel,"
<< " anything else quits dispensing. \n";
cin >> ans;
if('Y'==ans || 'y' == ans)
{
pump.reset(); // zero old charges
ans = cin.get(); // eat <cr>
pump.dispense();
}
cout << "Thank you. Your charges are:\n" ;
pump.displayGasNCharges();
cout << endl;
cout << "\n\nAmount of gasoline remaining in main tank is: ";
pump.displayAmountInMainTank();
cout << " gallons\n";
return 0;
}
5. Fraction
Define a class for a type called Fraction. This class is used to represent a ratio of two integers.
Include mutator functions that allow the user to set the numerator and the denominator. Also
include a member function that returns the value of numerator / denominator as a double. Include
an additional member function that outputs the value of the fraction reduced to lowest terms, e.g.
instead of outputting 20/60 the method should output 1/3. This will require finding the greatest
common divisor for the numerator and denominator, and then dividing both by that number.
Embed your class in a test program.
//fraction.cpp
//This program defines a class for fractions, which stores a numerator
// and denominator. A member functions allows for retrieval of the
// fraction as a double and another outputs the value in lowest
// terms.
//The greatest common divisor is found to reduce the fraction.
// In this case we use a brute-force method to find the gcd, but

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
// a more efficient solution such as euclid's method could also be
// used.
#include <iostream>
#include <cstdlib>
using namespace std;
class Fraction
{
public:
double getDouble();
void outputReducedFraction();
void setNumerator(int n);
void setDenominator(int d);
private:
int numerator;
int denominator;
int gcd(); // Finds greatest common divisor of numerator
// and denominator
};
// --------------------------------
// ----- ENTER YOUR CODE HERE -----
// --------------------------------
// ======================
// Fraction::getDouble
// Returns the fraction's value as a double
// ======================
double Fraction::getDouble()
{
return (static_cast<double>(numerator) / denominator);
}
// ======================
// Fraction::outputReducedFraction
// Reduces the fraction and outputs it to the console.
// ======================
void Fraction::outputReducedFraction()
{
int g;
g = gcd();
cout << numerator / g << " / " << denominator / g << endl;
return;
}
// ======================
// Fraction::setNumerator
// Mutator to change the numerator
// ======================
void Fraction::setNumerator(int n)
{
numerator = n;
}

Savitch, Absolute C++ 6/e: Chapter 6, Instructor’s Manual
Copyright © 2016 Pearson Education Addison-Wesley. All rights reserved.
// ======================
// Fraction::setDenominator
// Mutator to change the denominator
// ======================
void Fraction::setDenominator(int d)
{
denominator = d;
}
// ======================
// Fraction::gcd
// Finds greatest common divisor of numerator and denominator
// by brute force (start at larger of two, work way down to 1)
// ======================
int Fraction::gcd()
{
int g; // candidate for gcd, start at the smaller of the
// numerator and denominator
if (numerator > denominator)
{
g = denominator;
}
else
{
g = numerator;
}
// Work down to 1, testing to see if both numerator and denominator
// can be divided by g. If so, return it.
while (g>1)
{
if (((numerator % g)==0) && ((denominator % g)==0))
return g;
g--;
}
return 1;
}
// --------------------------------
// --------- END USER CODE --------
// --------------------------------
// ======================
// main function
// ======================
int main()
{
// Some test fractions
Fraction f1, f2;
f1.setNumerator(4);
f1.setDenominator(2);
cout << f1.getDouble() << endl;
f1.outputReducedFraction();

Exploring the Variety of Random
Documents with Different Content

27.Act of June 24, 1834, appropriates $200,000 for
continuing the road in Ohio; $150,000 for
continuing the road in Indiana; $100,000 for
continuing the road in Illinois, and $300,000 for
the entire completion of repairs east of Ohio, to
meet provisions of the Acts of Pennsylvania (April
4, 1831), Maryland (Jan. 23, 1832), and Virginia
(Feb. 7, 1832), accepting the road surrendered to
the States, the United States not thereafter to be
subject for any expense for repairs. Places
engineer officer of army in control of road
through Indiana and Illinois, and in charge of all
appropriations. $300,000 to be paid out of any
money in the Treasury not otherwise
appropriated, balance from acts admitting Ohio,
Indiana and Illinois 750,000 00
28.Act of June 27, 1837, (General Appropriation) for
arrearages due contractors 1,609 36
  Carried forward
$4,720,006
44
  Brought forward
$4,720,006
44
29.Act of March 3, 1835, appropriates $200,000 for
continuing the road in the State of Ohio;
$100,000 for continuing road in the State of
Indiana; to be out of fund acts admitting Ohio,
Indiana and Illinois, and $346,186.58 for the
entire completion of repairs in Maryland,
Pennsylvania and Virginia; but before any part of
this sum can be expended east of the Ohio river,
the road shall be surrendered to and accepted by
the States through which it passes, and the
United States shall not thereafter be subject to
any expense in relation to said road. Out of any
money in the Treasury not otherwise appropriated646,186 58

30.Act of March 3, 1835, (Repair of Roads)
appropriates to pay for work heretofore done by
Isaiah Frost on the Cumberland Road, $320; to
pay late Superintendent of road a salary, $862.87 1,182 87
31.Act of July 2, 1836, appropriates for continuing
the road in Ohio, $200,000; for continuing road in
Indiana, $250,000, including materials for a
bridge over the Wabash river; $150,000 for
continuing the road in Illinois, provided that the
appropriation for Illinois shall be limited to
grading and bridging, and shall not be construed
as pledging Congress to future appropriations for
the purpose of macadamizing the road, and the
moneys herein appropriated for said road in Ohio
and Indiana must be expended in completing the
greatest possible continuous portion of said road
in said States so that said finished part thereof
may be surrendered to the States respectively; to
be paid from acts admitting Ohio, Indiana, Illinois
and Missouri 600,000 00
32.Act of March 3, 1837, appropriates $190,000 for
continuing the road in Ohio; $100,000 for
continuing the road in Indiana; $100,000 for
continuing road in Illinois, provided the road in
Illinois shall not be stoned or graveled, unless it
can be done at a cost not greater than the
average cost of stoning and graveling the road in
Ohio and Indiana, and provided that in all cases
where it can be done the work to be laid off in
sections and let to the lowest substantial bidder.
Sec. 2 of the act provides that Sec. 2 of act of
July 2, 1836, shall not be applicable to
expenditures hereafter made on the road, and
$7,183.63 is appropriated by this act for repairs
397,183 63

east of the Ohio river; to be paid from the acts
admitting Ohio, Indiana and Illinois
  Carried forward
$6,364,559
52
  Brought forward
$6,364,559
52
33.Act of May 25, 1838, appropriates for continuing
the road in Ohio, $150,000; for continuing it in
Indiana, including bridges, $150,000; for
continuing it in Illinois, $9,000; for the completion
of a bridge over Dunlap’s creek at Brownsville; to
be paid from moneys in the Treasury not
otherwise appropriated and subject to provisions
and conditions of act of March 3, 1837 459,000 00
34.Act of June 17, 1844, (Civil and Diplomatic)
appropriates for arrearages on account of survey
to Jefferson, Mo. 1,359 81
  Total
$6,824,919
33
Note—The appropriation of $3,786 60, made by act of Feb. 26, 1812, is not
included in the above total for the reason that it was a balance from a former
appropriation.
The act of March 3, 1843, appropriates so much as is necessary to settle certain
claims on contract for building bridges over Kaskaskia river and constructing part
of Cumberland Road.

HON. T. M. T. McKENNAN.

CHAPTER XV.
Speech of Hon. T. M. T. McKennan, delivered in Congress, June 6,
1832—The Road a Monument of National Wealth and
Greatness—A Bond of Union—Business of the Road—Five
Thousand Wagons unload in Wheeling in a single year—
Facilities afforded by the Road for transporting the Mails and
Munitions of War.
This road, Mr. Speaker (the National Road), is a magnificent one—
magnificent in extent; it traverses seven different States of this
Union, and its whole distance will cover an extent of near eight
hundred miles. Magnificent in the difficulties overcome by the wealth
of a nation, and in the benefits and advantages and blessings which
it diffuses, east and west, far and wide, through the whole country.
It is, sir, a splendid monument of national wealth and national
greatness, and of the deep interest felt by the government in the
wealth and prosperity and happiness of the people.
It is not, sir, like the stupendous monuments of other countries and
of other times, which have been erected merely for the purpose of
show and of gratifying the pride of some despotic monarch; but this
and all similar national improvements are works of utility; they tend
to cement the bond of union; they bring together the distant parts
of this exalted republic; they diffuse wealth and happiness among a
free people, and will be a source of never failing prosperity to
millions yet unborn.
It is, sir, a great commercial, military, mail, national work. To give
the House, or those of its members who are unacquainted with the
fact, some idea of the immense commercial advantages which the
eastern as well as the western country has derived from the
construction of this road, let me call their attention to the amount of
merchandise transported to the Ohio river in a single year after its

completion; and here, sir, I avail myself of an estimate made by an
honorable member of the other House on another occasion, when
he strongly urged the propriety and importance of the extension of
the road through the State of Ohio.
In the year 1822, shortly after the completion of the road, a single
house in the town of Wheeling unloaded 1,081 wagons, averaging
about 3,500 pounds each, and paid for the carriage of the goods
$90,000. At that time there were five other commission houses in
the same place, and estimating that each of them received two-
thirds the amount of goods consigned to the other, there must have
been nearly 5,000 wagons unloaded, and nearly $400,000 paid as
the cost of transportation. But, further, it is estimated that at least
every tenth wagon passed through that place into the interior of
Ohio, Indiana, &c., which would considerably swell the amount.
These wagons take their return loads and carry to the eastern
markets all the various articles of production and manufacture of the
West—their flour, whisky, hemp, tobacco, bacon, and wool. Since
this estimate was made, the town of Wheeling is greatly enlarged;
its population has nearly doubled; the number of its commercial
establishments has greatly increased; and the demand for
merchandise in the West has increased with the wealth and
improvement and prosperity of the country.
But, further, sir, before the completion of this road, from four to six
weeks were usually occupied in the transportation of goods from
Baltimore to the Ohio river, and the price varied from six to ten
dollars per hundred. Now they can be carried in less than half the
time and at one-half the cost, and arrangements are making by
some enterprising gentlemen of the West to have the speed of
transportation still increased, and the price of carriage diminished.
Equally important are the benefits derived by the government and
the people from the rapid, regular, and safe transportation of the
mail on this road. Before its completion, eight or more days were
occupied in transporting the mail from Baltimore to Wheeling; it was
then carried on horseback, and did not reach the western country by

this route more than once a week. Now it is carried in comfortable
stages, protected from the inclemency of the weather, in forty-eight
hours; and no less than twenty-eight mails weekly and regularly
pass and repass each other on this road. To show this fact, and the
absolute necessity and importance of keeping the road in a good
state of repair, in order to enable the postoffice department to fulfill
the expectations of the public, I will ask the favor of the clerk to
read to the House a communication received from the Postmaster
General on the subject. [Here the clerk read an extract from a letter
of the Postmaster General]. The facilities afforded by such a road in
time of war for the transportation of the munitions of war, and the
means of defence from one point of the country to another, need
scarcely be noticed; they must be palpable and plain to every
reflecting mind, and I will not take up the time of the House in
detailing them.
As I said before, the road traverses seven different States of this
Union, and in its whole extent will cover a distance of near 800
miles. Who, then, can doubt its nationality? Who can question the
allegation that it is an immensely important national work? Who can
reconcile it to his conscience and his constituents to permit it to go
to destruction?

ROAD WAGON

CHAPTER XVI.
Life on the Road—Origin of the Phrase Pike Boys—Slaves Driven
Like Horses—Race Distinction at the Old Taverns—Old
Wagoners—Regulars and Sharpshooters—Line Teams—John
Snider, John Thompson, Daniel Barcus, Robert Bell, Henry
Clay Rush, and other Familiar Names.
As the phrase “Pike Boys” is frequently used in this volume, it is
considered pertinent to give its origin. When first used, it was
confined in its application to boys—sons of wagoners, stage drivers,
tavern keepers, farmers, and in fact the sons of persons of every
occupation who lived on or adjacent to the road, in the same sense
that the boys of a town are called “town boys.” Its meaning and
import, however, expanded in course of time, until it embraced, as it
now does, all persons in any manner and at any time identified with
the road, whether by residence or occupation, and without “regard
to age, race, color or previous condition of servitude,” as the statute
puts it, for be it remembered that negro slaves were frequently seen
on the National Road. The writer has seen them driven over the road
arranged in couples and fastened to a long, thick rope or cable, like
horses. This may seem incredible to a majority of persons now living
along the road, but it is true, and was a very common sight in the
early history of the road and evoked no expression of surprise, or
words of censure. Such was the temper of the times. There were
negro wagoners on the road, but negro stage drivers were unknown.
Stage driving was quite a lofty calling, and the acme of many a
young man’s ambition. The work was light and the whirl exciting and
exhilarating. Wagoners, white and black, stopped over night at the
same taverns, but never sat down together at the same table. A
separate table was invariably provided for the colored wagoners, a
custom in thorough accord with the public sentiment of the time,
and seemingly agreeable to the colored wagoners themselves.

Country life in the olden time was enlivened by numerous corn
huskings, balls, spelling matches, school exhibitions and frolics of all
kinds. Young men and boys along the road, were in the habit of
attending these gatherings, going as far as three miles and more in
the back country, to reach them, some on foot and others on
horseback. A young man would think nothing of getting a girl up
behind him on a horse, and hieing away after nightfall, four and five
miles to a country dance, and many of the girls of the period
considered it but pleasant recreation to walk two or three miles with
their lovers, to a spelling match or a revival meeting. A feeling of
jealousy always existed between the young men and boys, living
along and near the road, and those in the back country, and the
occasions before mentioned furnished opportunities from time to
time for this feeling to break out, as it often did, in quarrels and
fights. The country boys would get together in anticipation of an
approaching gathering at some school house, and organize for
offense or defense, as the exigencies might require, always calling
their rivals and imaginary enemies, “Pike Boys,” and this was the
origin of that familiar phrase.
The men who hauled merchandise over the road were invariably
called wagoners, not teamsters, as is the modern word, and they
were both, since Webster defines wagoner as one who conducts a
wagon, and teamster as one who drives a team. The teams of the
old wagoners consisting, as a rule, of six horses, were very rarely
stabled, but rested over night on the wagon yards of the old taverns,
no matter how inclement the weather. Blankets were used to protect
them in the winter season. Feed troughs were suspended at the rear
end of the wagon bed, and carried along in this manner, day after
day all the year round. In the evening, when the day’s journey was
ended, the troughs were taken down and fastened on the tongues of
the wagon to which the horses were tied, three on a side, with their
heads to the trough. Wagoners carried their beds, rolled up, in the
forepart of the wagon, and spread them out in a semi-circle on the
bar room floor in front of the big bar room fire upon going to rest.
Some of the old bar room grates would hold as much as six bushels

of coal, and iron pokers from four to six feet in length, weighing
eight and ten pounds, were used for stirring the fires. To get down
an icy hill with safety, it was necessary to use an ice cutter, a rough
lock, or a clevis, and sometimes all combined, contingent upon the
thickness and smoothness of the ice, and the length and steepness
of the hill. The ice cutter was of steel or iron, in appearance like a
small sled, fitted on the hind wheels, which were first securely
locked. The rough lock was a short chain with large, rough links, and
the clevis was like that used on an ordinary plow, except that it was
larger and stronger. These instruments were essential parts of the
wagoners’ “outfit.” There were two classes of wagoners, the
“regular” and the “sharpshooter.” The regular was on the road
constantly with his team and wagon, and had no other pursuit than
hauling goods and merchandise on the road. The sharpshooters
were for the most part farmers, who put their farm teams on the
road in seasons when freights were high, and took them off when
prices of hauling declined; and there was jealousy between the two
classes. The regular drove his team about fifteen miles a day on the
average, while the sharpshooter could cover twenty miles and more.
Line teams were those controlled by an association or company.
Many of the regular wagoners became members of these companies
and put in their teams. The main object of the combination was to
transport goods more rapidly than by the ordinary method. Line
teams were stationed along the road, at distances of about fifteen
miles, and horses were exchanged after the manner of the stage
lines. Many of the old wagoners had bull-dogs tied at the rear of
their wagons, and these dogs were often seen pressing with all their
strength against the collar about their necks, as if to aid the horses
in moving their load; and this is probably the origin of the common
form of boast about a man being equal in strength to “a six-horse
team with a cross dog under the wagon.”

JOHN THOMPSON.
The whip used by old wagoners was apparently five feet long, thick
and hard at the butt, and tapering rapidly to the end in a silken
cracker. Battley White, of Centerville, Washington county, Pa., made
more of these whips than any other man on the road. The interior of
his whip was a raw hide. John Morrow, of Petersburg, Somerset
county, Pa., also made many whips for the old wagoners. There was
another whip, much used by old wagoners, known as the “Loudon
Whip.” The inner portion of this whip was an elastic wooden stock,
much approved by the wagoners. It was manufactured in the village
of Loudon, Franklin county, Pa., and hence its name. It was used
almost exclusively on what was called the “Glade Road,” from
Philadelphia to Pittsburg, via Chambersburg and Bedford.

Some of the old wagoners of the National Road became rich. John
Snider was one of these. He drove a six-horse team on the road for
twenty years, and died on his farm near Uniontown in December,
1889, much lamented. Few men possessed more of the higher
attributes of true manhood than John Snider. The author of this
volume gratefully and cheerfully acknowledges his indebtedness to
John Snider for many of the facts and incidents it contains. He was a
clear-headed, intelligent, sober, discreet, and observing man, whose
statements could be relied on as accurate.
It would be an impossible task to collect the names of all the old
wagoners of the National Road. They number thousands, and many
of them left the road long since to seek fortunes in new and distant
sections of our widely extended country. The most of them have
gone to scenes beyond the boundaries of time. It is the author’s aim
to collect as many of their names as is practicable and write them
down in history. The names of John Thompson, James Noble, and
John Flack are recalled. These worthy old wagoners are still living in
the vicinity of Taylorstown, Washington county, Pa., and highly
respected by all their neighbors. The point at which they first
entered upon the road was the famous “S” bridge. Thompson drove
his father’s team when quite young, in fact, a mere boy. The first trip
he made over the road was in the spring of 1843, in company with
the veteran wagoner, George Hallam, of Washington, Pa.
Thompson’s father was a pork packer, and the youthful wagoner’s
“down loads,” as those moving eastwardly were called, consisted for
the most part of bacon. His recollections of the road are vivid, and
warmly cherished. He can sit down in a room, at his comfortable
home, and “in his mind’s eye” see every mile post along the road
and recall the distances to points inscribed thereon. In the year
1852, he went to California, engaged in mining, and was successful.
With the instinct planted in every human breast, he returned to his
native land, and with his accumulations bought his father’s
homestead farm. The old farm enhanced in value by reason of the
oil developments, and landed the old wagoner in the ranks of the
rich.

The name Noble is a familiar one on the National Road, and
suggestive of rank. “Watty” and William Noble were stage drivers.
James Noble, the old wagoner, drove a team for the late Hon. Isaac
Hodgens, who was at one time a pork salter. He remained on the
road as a wagoner until its tide of business ceased, and retired to
Taylorstown to take his chances in the on-moving and uncertain
affairs of life. He seemed possessed of the idea that there was
undeveloped wealth in the vicinity of Taylorstown, and made up his
mind to gain a foothold there and wait the coming of events. He
managed by the exercise of industry and economy to become the
owner of a farm, and the discovery of oil did the rest for him. He is
rich.
John Flack’s career is similar to those of Thompson and Noble,
culminating in like good fortune. “He struck oil, too.”
We have in the story of these old wagoners, examples of the
possibilities for achievement, under the inspiring genius of American
institutions. Poor boys, starting out in life as wagoners, with wages
barely sufficient for their subsistence, pushing on and up with
ceaseless vigilance, attaining the dignity of farmers, in all ages the
highest type of industrial life, and now each bearing, though meekly,
the proud title of “freeholder,” which Mr. Blaine said in his celebrated
eulogium of Garfield, “has been the patent and passport of self-
respect with the Anglo-Saxon race ever since Horsa and Hengist
landed on the shores of England.”

DANIEL BARCUS.
Otho and Daniel Barcus, brothers, were among the prominent
wagoners of the road. They lived near Frostburg, Md. Otho died at
Barton, Md., in 1883. Daniel is now living in retirement at Salisbury,
Somerset county, Pa. In 1838 he engaged with John Hopkins,
merchant at the foot of Light and Pratt streets, Baltimore, to haul a
load of general merchandise, weighing 8,300 pounds, to Mt. Vernon,
Ohio. “He delivered the goods in good condition” at the end of thirty
days from the date of his departure from Baltimore. His route was
over the National Road to Wheeling, thence by Zanesville and
Jacktown, Ohio, thence thirty-two miles from the latter place to the
point of destination, the whole distance being 397 miles. He received
$4.25 per hundred for hauling the goods. At Mt. Vernon he loaded
back with Ohio tobacco, 7,200 pounds in hogsheads, for which he

received $2.75 per hundred. On the return trip he upset, between
Mt. Vernon and Jacktown, without sustaining any damage, beyond
the breaking of a bow of his wagon bed, and the loss caused by
detention. The expense of getting in shape for pursuing his journey,
was the price of a gallon of whisky. Mt. Vernon is not on the line of
the road, and Mr. Barcus writes that “when he reached the National
Road at Jacktown, he felt at home again.” Mr. Barcus also states in a
letter to the writer of these pages, that the first lot of goods shipped
over the Baltimore and Ohio railway, after its completion to
Cumberland, destined for Wheeling, was consigned to Shriver and
Dixon, commission merchants of Cumberland, and by that firm
consigned to Forsythe and Son, of Wheeling. This lot of goods
aggregated 6,143 pounds, an average load for a six-horse team, and
Mr. Barcus contracted with Shriver and Dixon to haul it through to
Wheeling in six days for fifty cents a hundred, which he
accomplished. He further states that a delegation of wholesale and
retail merchants of Wheeling met him at Steenrod’s tavern, east of
Wheeling Hill, and escorted him to town, then a place of 4,000 or
5,000 inhabitants, and in the evening there was public rejoicing over
the unprecedented event of goods reaching Wheeling from Baltimore
in the short space of seven days. Mr. Barcus concludes his letter as
follows: “I stayed many nights at Hopwood with Wilse Clement, and
many with Natty Brownfield, in Uniontown. I often stayed with
Arthur Wallace, five miles east of Brownsville. I remember one night
at Wallace’s, after caring for my team, I accompanied his two fine
and handsome daughters to a party about a mile distant in the
country, where I danced all night, till broad daylight, and then
walked home with the girls in the morning.”
John Grace was another old wagoner, who became wealthy. The old
pike boys will remember him as the driver of a black team. He was a
Maryland man. When the old road yielded its grasp on trade, to the
iron railway, Grace settled in or near Zanesville, Ohio, where he still
lives, or was living a few years ago, worth a hundred thousand
dollars. He transported his family to Ohio in his big road wagon.

Jesse Franks, and his son Conrad, of High House, Fayette county,
Pa., were old wagoners. Conrad’s team ran off near Cumberland, on
one of his trips, overthrowing the wagon, and causing an ugly
dislocation of Conrad’s thigh, from which he suffered great pain for
many weeks.
John Manaway, late owner of the Spottsylvania House, Uniontown,
drove a team on the road for many years, and no man enjoyed the
business more than he.
There was an Ohio man of the name of Lucas, called Gov. Lucas,
because a man of like name was an early Governor of Ohio, who
was an old wagoner, and his team consisted of but five horses, yet
he hauled the biggest loads on the road. He was the owner of the
team he drove. In the year 1844, one of his loads weighed twelve
thousand pounds—“one hundred and twenty hundred,” as the old
wagoners termed it, and the biggest load ever hauled over the road
up to that date.
William King, of Washington county, Pa., an old wagoner, was noted
for his steady habits. On one of his trips over the road, and going
down the eastern slope of Laurel Hill, when it was covered with ice,
his wagon slipped from the road and fell over the bank near the old
Price residence, dragging the team after it. Strange to say, the
horses were uninjured and but little damage done to the wagon. The
contents of the load were Ohio tobacco and bacon. After getting
things restored, King drove to Jimmy Snyder’s, stayed all night, and
the next morning proceeded on his journey to Baltimore. He was the
owner of a farm in Washington county.
Joseph Thompson, an old wagoner on the road, is now and has
been for many years in charge of the large and valuable coal farm
belonging to the estate of the Hon. James G. Blaine, on the
Monongahela river, near Pittsburg. A trusty old wagoner, he has
approved himself the trusty agent of the great statesman.
Jacob Probasco was an old wagoner, and also kept a tavern at
Jockey Hollow. He went west and founded a fortune.

Joseph Lawson, an old wagoner, kept tavern for many years in West
Alexander, Washington county, Pa., and died the possessor of a
valuable estate. The author of this book took dinner, in 1848, at
Lawson’s tavern, in company with James G. Blaine, the late
distinguished Secretary of State.
Matthias Fry, an old wagoner, kept the Searight House in 1840, and
subsequently presided as landlord over several houses at different
times in Hopwood. He was one of the best men on the road. His
large and well proportioned form will be readily recalled by the old
pike boys. He was a native of Old Virginia, and died in Hopwood.
David Hill was one of the most noted wagoners of the road. He was
an active, bustling man, and given to witty sayings. He belonged to
Washington county, Pa., and was the father of Dr. Hill, of Vanderbilt,
and the father-in-law of the Rev. J. K. Melhorn, who preached for
many years in the vicinity of McClellandtown, Fayette county, Pa.
Andrew Prentice, who died recently in Uniontown, the possessor of
considerable money, drove a team on the old road in his early days.
Henry Clay Rush, a prominent citizen of Uniontown, and ex-jury
commissioner, was once the proud driver of a big six-horse team. He
drove through from Baltimore to Wheeling, and can recount
incidents of every mile of the road to this day. None of the old pike
boys enjoys with keener relish a recital of the stories of the old pike
than Rush.
William Worthington, who died not long since in Dunbar township,
Fayette county, Pa., aged upwards of ninety years, was one of the
earliest wagoners on the road. When he made his first trip he was
only thirteen years old, and the road was then recently opened for
travel. He continued as a wagoner on the road for many years, and
located in Dunbar township, where he purchased property, which
subsequently became very valuable by reason of the coal
development.
William Chenriewith, who recently, and probably at the present time,
keeps a hotel near Bedford Springs, was an old wagoner of the

National Road.
HENRY CLAY RUSH.
John Thomas, who kept a hotel and livery stable in Baltimore, was
an old wagoner, and is well remembered along the road.
George Buttermore, father of Dr. Smith Buttermore, of Connellsville,
was at one time a wagoner on the National Road.
John Orr, now a prosperous and well-known farmer of the vicinity of
West Newton, Westmoreland county, Pa., was an old wagoner of the
road.
James Murray, an old wagoner, is remembered for his extravagance
of speech. One of his sayings was, that “he saw the wind blow so

hard on Keyser’s Ridge, that it took six men to hold the hair on one
man’s head.”
E. W. Clement, of Hopwood, was an old wagoner, and invariably
used bells on his horses. He subsequently kept a tavern in Hopwood,
and built the house there known as the “Shipley House.”
Robert Bell was an old wagoner with quaint ways. He was rich, and
owned his team, which was the poorest equipped of any on the
road. Horses in his team were not infrequently seen without bridles.
He was a trader, and often bought the goods he hauled and sold
them out to people along the road. His reputation for honesty was
good, but he was called “Stingy Robert.”
George Widdle, an old wagoner of the age of eighty and upwards,
still living in Wheeling, drew the single line and handled the Loudon
whip over a six-horse team for many years, between Wheeling and
Baltimore, and accounts the days of those years the happiest of his
existence. He was also a stage driver for a time. Nothing affords him
so much pleasure as a recital of the incidents of the road. He says
there never were such taverns and tavern keepers as those of the
National Road in the days of its glory, and of his vigorous manhood.
James Butler, like Bell, was a trader. Butler drove a “bell team,” as
teams with bells were called. He was a Virginian, from the vicinity of
Winchester. It was the tradition of the road that he had a slight
infusion of negro blood in his veins, and this assigned him to the
side table of the dining room. When he quit the road he returned to
Winchester, started a store, and got rich.
Neither tradition or kindred evidence was necessary to prove the
race status of Westley Strother. He showed up for himself. He was as
black as black could be, and a stalwart in size and shape. He was
well liked by all the old wagoners, and by every one who knew him.
He was mild in manner, and honest in purpose. He had the strongest
affection for the road, delighted in its stirring scenes, and when he
saw the wagons and the wagoners, one after another, departing

from the old highway, he repined and prematurely died at
Uniontown.

CHAPTER XVII.
Old Wagoners continued—Harrison Wiggins, Morris Mauler, James
Mauler, John Marker, John Bradley, Robert Carter, R. D.
Kerfoot, Jacob F. Longanecker, Ellis B. Woodward—Broad
and Narrow Wheels—A peculiar Wagon—An experiment and
a failure—Wagon Beds—Bell Teams.
Harrison Wiggins, widely known as a lover of fox hunting, and highly
respected as a citizen, was one of the early wagoners. His career as
a wagoner ceased long before the railroad reached Cumberland. He
hauled goods from Baltimore to points west. His outfit, team and
wagon, were owned by himself and his father, Cuthbert Wiggins.
Harrison Wiggins was born in the old Gribble house, two miles east
of Brownsville, on the 30th of April, 1812. About the year 1817 his
father moved to Uniontown, and kept a tavern in a frame building
which stood on the lot adjoining the residence of P. S. Morrow, Esq.
He remained here until 1821, when he went to the stone house at
the eastern base of Chalk Hill, and was its first occupant. His house
at Uniontown numbered among its patrons, Hon. Nathaniel Ewing,
Samuel Cleavenger, Mr. Bouvier, John A. Sangston, John Kennedy,
John Lyon, and other eminent men of that period. In 1832 or ’33,
Harrison Wiggins married a daughter of John Risler, a noted tavern
keeper of the road, one of the very best, a talent which descended
to his children. At the date of the marriage Mr. Risler was keeping
the stone house at Braddock’s run, and the wedding occurred in that
house. In 1839 Harrison Wiggins went to Iowa, with a view of
locating in that State, but returned the next year and leased the
property on which he now lives from Charles Griffith. In ten years
thereafter he bought this property, and it has been his home for
more than half a century. Under the careful and sagacious
management of Mr. Wiggins, it has become one of the prettiest and
most valuable properties in the mountains. It has been a long time

since he was a wagoner, but he enjoys a recital of the stirring scenes
he witnessed on the old road in the days of its glory.
HARRISON WIGGINS.
There is not a more familiar name among the old pike boys than that
of Morris Mauler. He was an old wagoner, stage driver and tavern
keeper. He was born in Uniontown in the year 1806. The house in
which he first beheld the light of day, was a log building on the
Skiles corner, kept as a tavern by his father. Before he reached the
age of twenty-one he was on the road with a six-horse team and a
big wagon, hauling goods from the city of Baltimore to points west.
He continued a wagoner for many years, and afterward became a
stage driver. He drove on Stockton’s line. From stage driving he went
to tavern keeping. His first venture as a tavern keeper was at Mt.
Washington, when the old tavern stand at that point was owned by