This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ELEG 025 - 4 Lab Assignment # 4 Closed Book: 2 Hours June 11, 2003 Name: _________________________ ID: __________________________ 1. Create a class Rectangle with integer attributes width and length with both defaulting to 1. It should also have member functions that calculate and return the perimeter and the area of a rectangle object. It should have a constructor member function that takes two integer parameters and construct a rectangle object out of them, and verify that they are larger than 0 but smaller than 100. Test your class in a simple program that creates an array of rectangle objects and then reads a set of width and length pairs and make rectangles out of each pair using the constructor. Use the perimeter and area functions to print the corresponding information about the various rectangle objects. 2. Write a program to carry out manipulation on sets. Create a class called set with two private members , the elements of the set and the size of the set. The elements should be an array of integers to hold an appropriate number of elements (e.g. 20), assumed to be positive integers. Provide a default constructor to (e....
View Full Document
This note was uploaded on 02/26/2010 for the course EECE 230 taught by Professor Samikaraki during the Fall '07 term at American University of Beirut.
- Fall '07