CS 630 - Computing Fundamentals I - Summer 2004
Homework 5
Loyola College >
Department of Computer Science >
CS 630 >
Homework >
Homework 5
Due
Wednesday, July 7th at the beginning of class
Email programs (.cpp files) to lawrie@cs.loyola.edu
Problems
Problem 1: Line2D class
Problem 2: 6.3
Problem 3: Write a C++ class definition for an abstract data type describing a food item consisting of the attributes and methods given. The attributes are as follows:
- description (string)
- size (floating-point number)
- price (floating-point number having two decimal points)
The member functions are:
- a constructor that takes three parameters and is used to initialize all three attributes
- a function setPrice that changes the price of the food item to the value the caller specified
- a function getPrice that returns to the caller the price of the food item
- a function displayItem that displays in a readable form the information about the food item
- a functions calcUnitPrice that calculates the unit price of the food item and returns the value
*This is just the header file.
Problem 4: 4.30