ISE 103
Programming II
February 19, 2007
Homework 1
Classes
Write a program which
contains C++ class definition for an abstract data type describing a bookstore
inventory. Each book has the following attributes:
·
Book
title (Character String)
·
Book
Author (Character String)
·
Book
Price (Floating-point number having two decimal places)
·
Count
of books on hand (Integer)
The member functions are as
follows:
·
A
constructor that is used to initialize all eight elements of the array (to any
values you want)
·
A
display_all function that displays in a readable tabular form the contents
of the entire book colection
·
A
modify
function that, once called, prompts the user first for a book number (1 through
8) and then for a code (T, A, P, or C) indicating which attribute (title,
author, price, or count) of the indicated book is to be changed; finally, the
function should provide a prompt for the new value of the attribute.
·
Your
display
function displays the information for a single book in your inventory.
Reasonable tests for valid
input should be performed in the modify function. Write the declaration for an
object named inventory of the type described by this class.
Submit your programs in the
following format:
your_class.h, your_class.cpp and driver.cpp
Due Date: March 12, 2007
Submition: mercan@be.itu.edu.tr (e-mail subject: hw1, student_name_surname)
Compiling: GNU C++, Visual C++, .NET,
MONO
Dr. Serdar CELEBI