CSCI 159 Bonus lab exercises

The bonus lab is an independent exercise (we won't be specifically covering it in the labs), and is due by 11:59:59pm Friday Dec. 5th

Unlike previous labs, there is only a single exercise for the bonus lab, to be completed in bonus.cpp.

We'll have struct definitions, function prototypes, and a main routine that you'll be required to use, and will provide some handy supporting functions, but the internal design/implementation of most key functions will be left to the student.

Here is the collection of new C++ syntax elements we'll be using for the bonus lab.

We'll also be working with code elements from nearly all the labs so far, so refer to the appropriate lab syntax page as needed for refreshers.


Follow our usual setup process

  1. Log in, open a browser, go to the bonus lab page, open a terminal window:
    (see lab 2 if you need a refresher on any of the steps)

  2. get the bonus lab:

  3. Go into your newly created bonus directory and begin the edit/compile/test/submit routine: As with previous labs, you'll see that the .cpp file is nearly empty to start with.


Design exercise (to be done in bonus.cpp)

The overall purpose of the bonus lab will be to get practical experience working with pointers and arrays of structs, so there will be some restrictions on the data types and functions you're required to use.

The functionality of our bonusx executable will be to read in information about a collection of packages: getting the sender and receiver's names, the delivery address, and the estimated valule of each package. We'll be storing the information in an array that has one element for each package, but we'll be dynamically allocating entries when a package is sent and deleting them when the package is received.

As the program runs, the user can add new packages to the collection, have packages removed as they are delivered, display the information for all the packages currently waiting to be delivered, and display the number and total value of all packages delivered so far.

First: setting up the libraries, constants, and struct definitions we'll need

STILL T.B.D.

Second: core suite of function prototypes

STILL T.B.D.

Third: a matching main

STILL T.B.D.

Fourth: sample implementations for supporting functions

You are welcome to write your own internal implementations for these functions, but the prototypes cannot be changed (i.e. the function names, return types, and parameter lists must remain as they are).

STILL T.B.D.

Finally, your core task: designing and implementing the core functions

STILL T.B.D.

Sample run:

STILL T.B.D.