Docsity

Turnpike Problem Solution Check - Computer Science II - Prof. Thomas A. Bailey, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
CoSc 2030 5 December 2020
Computer Science II
Fall 2008 page 1 of 2
Programming Project 9a
Also consider Programming Project 9b.
Due Friday, 5 December 2008
Check a Proposed Solution to an Instance of the Turnpike Problem
The Interstate Commerce Commission needs a program that solves the
following Turnpike Problem. The solution will be used to monitor the work of
the Wyoming Department of Transportation, thereby simplifying the tasks of
both governmental entities. This will improve our quality of life and lower
our taxes at the federal and state level. So do good work!
The Turnpike Problem:
Given a list of all distances between turnpike interchanges, determine
the mile marker positions of each of the interchanges. Assume one of
the interchanges is positioned at mile marker zero.
An initial step toward solving the problem is to check proposed solutions.
This is the task of this programming project.
Write code for two classes, TurnDistSet and TurnLocSet. TurnDistSet stores
and manipulates a list of distances between turnpike interchanges.
TurnLocSet stores and manipulates a list of turnpike interchange locations.
Here is the client code that must be supported by your classes:
int
main()
{
TurnDistSet distances;
cin >> distances;
TurnLocSet mileMarkers;
while( cin >> mileMarkers )
{
cout << endl << "Locations set" << endl;
cout << mileMarkers << endl;
if( TurnDistSet( mileMarkers ) == distances )
pf2

Partial preview of the text

Download Turnpike Problem Solution Check - Computer Science II - Prof. Thomas A. Bailey and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CoSc 2030 5 December 2020 Computer Science II Fall 2008 page 1 of 2 Programming Project 9a Also consider Programming Project 9b. Due Friday, 5 December 2008 Check a Proposed Solution to an Instance of the Turnpike Problem The Interstate Commerce Commission needs a program that solves the following Turnpike Problem. The solution will be used to monitor the work of the Wyoming Department of Transportation, thereby simplifying the tasks of both governmental entities. This will improve our quality of life and lower our taxes at the federal and state level. So do good work! The Turnpike Problem: Given a list of all distances between turnpike interchanges, determine the mile marker positions of each of the interchanges. Assume one of the interchanges is positioned at mile marker zero. An initial step toward solving the problem is to check proposed solutions. This is the task of this programming project. Write code for two classes, TurnDistSet and TurnLocSet. TurnDistSet stores and manipulates a list of distances between turnpike interchanges. TurnLocSet stores and manipulates a list of turnpike interchange locations. Here is the client code that must be supported by your classes: int main() { TurnDistSet distances; cin >> distances; TurnLocSet mileMarkers; while( cin >> mileMarkers ) { cout << endl << "Locations set" << endl; cout << mileMarkers << endl; if( TurnDistSet( mileMarkers ) == distances )

CoSc 2030 5 December 2020 Computer Science II Fall 2008 page 2 of 2 { cout << " is a solution for Distances set" << endl; } else { cout << " is NOT a solution for Distances set" << endl; } cout << distances << endl; } return 0; } Your classes must implement the constructors, destructors, functions, and methods called by this client code. Turn in a typed report in class on Friday. Your printed report will include:

  1. A title page with CoSc 2030 Program 9 Turnpike Solution Check in large font at the top of the page and a statement of help delivered and help received at the bottom of the page.
  2. A printout of your code for the two classes.
  3. A printout of the input and output for a production run of the driver.