CS183 -- Lab 1: Using Existing Classes



->Courses
->CS183
-->Homework
-->Examples
-->Quiz 1
->Lab 1
-->Lab 2
-->Project 1
-->Project 2
->Electronic Submission
->MSVC++ Info
->STL Info
->MFC/GUI Info
->Tentative Schedule
->Course Policies

[Courses]
[Rich][Home][Rich]
[PHome]

Spring Quarter 2001

Overview

The purpose of this lab is to design and implement a stand-alone program that incorporates basic C++ programming concepts. These concepts, covered in CS-182, are prerequisites for CS-183.

Acknowledgement

This lab was developed by Dr. Chris Taylor. The database file was generated from data available at www.freedb.org.

Activities

In this lab, you will:

  • Design a program to satisfy a problem statement.
  • Write, compile, build, and test the program.
  • Report on your results.

Problem Statement

You have been asked to design and implement a C++ program to read a CD database file and search the database. This program will make use of an existing class library containing the single class Disc. The Disc class holds information associated with a single compact disc. The definition of this class is in the file disc.h, while the implementation is in disc.cpp. Both files are contained in disc.zip. You should not modify the Disc files, but you will need to add them to your project.

Your program should:

  1. Prompt the user for the name of the CD database file to be analyzed. (The file soundtrack.cddb is included in disc.zip.)
  2. Open the CDDB file and use the readDisc member function from the Disc class to read in information about one CD at a time until the end of file is reached. (See disc.h for information on how to use the member functions from the Disc class.
  3. Create an output file that begins with your MSOE login name (e.g., for me, taylorLab1.out works) and contains:
    1. The total number of CD entries in the database.
    2. The number of CDs with more than 15 songs.
    3. The name and length of the shortest CD.
    4. A list of all the tracks that contain the word "cheese" (case insensitive) in the title along with the title of the CD on which they are found.
    5. The number of duplicate entries in the database (according to the == operator for the Disc class).
  4. Allow the user to search the database for a particular artist. (Display the contents of all albums by the artist to the console.)

Your program must have at least two functions in addition to main(), although you may choose to have more than two. One of these functions should read in the CD database and store the entries in a vector, and the other should write the output file. You may not use any global data objects (at file scope).

Detailed Instructions

If you have difficulties with any part of the lab, consult the instructor for assistance. The basic sequence is:

  1. Study the disc.h header file to determine what member functions are available to you and how they work.
  2. Prepare a design to meet the problem specifications, identifying:
    • Data objects.
    • Functions (with arguments and return values, if any).
    • Program structure (selection and iteration statements, etc.)
  3. Write the program (source code) to implement your design. Be sure to include internal documentation (comments) describing all data objects, function interfaces, and significant program segments.
  4. Test the program.
  5. Submit the lab report (details below).

Lab report (due 11:00pm, the day prior to week 3 lab)

The lab report should consist of the following:

  • Your design documentation.
  • The program output file.
  • A brief description of any problems you encountered or questions you have regarding the lab.
  • A summary of your activity log indicating how much time you spent on the assignment. In addition to the total time spent on the project, please report the time in the following categories:
    • Designing
    • Coding
    • Debugging (before you think it's working)
    • Testing (after you think it's working)
    • Writing report
    • Other
  • Any suggestions you have for how the lab could be improved.
  • The Documented source code for your program. Do not include the Disc files.

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well.

Your grade will depend on quality of design and clarity of the code and documentation, as well as whether your program produces the correct results. If you have any questions, consult your instructor.

© 2001 Dr. Christopher C. Taylor Office: CC-27C Phone: 277-7339 Last Updated: April 18, 2001
I am responsible for all content posted on these pages; MSOE is welcome to share these opinions but may not want to.