CSCI 136 - Fall 2018

Data Structures & Advanced Programming

Home | Lectures | Labs | Handouts | Links | CS@Williams

Lab 8: Queuing Simulation

The assignment this week is to complete 13.7 Laboratory: Simulating Business from Bailey: pages 341-342.

Important note: This week you may again work with a partner.

Pre-lab

Before lab, please do the following:

Lab Assignment

In prior labs we have developed programs to process data or solve problems using the data structures and programming concepts we discussed in lecture. This week, we will explore the ways that data structures appear in the physical world, comparing two scenarios:

We will build a simulation for both scenarios and then measure the performance of each approach. Instructions for this assignment can be found on pages 341--342 in Bailey. We have posted some suggestions below. We have also posted a sample abstract base class (BusinessSimulation.java) to help you design your program to simulate the two scenarios as well as a simple customer object (Customer.java) to get you started.

We would like you extend the abstract base BusinessSimulation class with two concrete classes, say OneQueue.java and MultiQueue.java. You should implement functionality common to the single-queue and multiple-queue simulations in the abstract base class

Approach

You should have a well-organized, well-commented program that simulates the two scenarios described above.

Thought questions

Please answer thought questions 1--4, and place your answers in the README.md file. Some notes:

Lab Deliverables

For this lab, please submit the following:

If you worked with a partner, submit one folder with your collaborative solution.

As in all labs, you will be graded on design, documentation, style, and correctness. Be sure to document your program appropriately: include pre/post conditions and assertions where appropriate. We will also be looking at how well you organize your code. Whenever you see yourself duplicating functionality, consider moving that code to a helper method. There are several opportunities in this lab to simplify your code by using helper methods. Think carefully!

Submitting Your Lab

As you complete various milestones, you should commit your changes and push them. Commit early and often. When the deadline arrives, we will retrieve the latest version of your code. If you are confident that you are done, please include "Lab Submission" as the commit message for your final commit. If you later decide that you have more edits to make, it is OK. We will look at the latest commit before the deadline.

We will know that the files are yours because they are in your git repository. Do not include identifying information in the code that you submit. Our goal is to grade the programs anonymously to avoid any bias. However, in your README.md file, please cite any sources of inspiration or collaboration (e.g., conversations with classmates). We take the honor code very seriously, and so should you. Please include the statement "I am the sole author of the work in this repository." (or "We are the sole authors of the work in this repository." if working pairs) In the comments at the top your Java file.