CIS 1033 - Fundamentals of Programming

Bob Comer, Professor, CIS/CSC


Programming Assignment 6 - Rectangle Class

MW class - Due Monday, July 12

 

Write a class called Rectangle that represents a rectangle as a pair of float values - the rectangle length and width. The data members of the class should be private members. Your class should include the following public functions:

Write a small client program to test your class. It should create one or more Rectangle objects, set their data members to various values, and print the rectangle dimensions and area on the monitor. All floating point values should be printed with one place to the right of the decimal point.

Sample Output
Your output might look like the example below. User input is shown in bold.
 

The rectangle dimensions are: 0.0 x 0.0
The rectangle area is: 0.0

Enter rectangle length: 10
Enter rectangle width : 5
The rectangle dimensions are: 10.0 x 5.0
The rectangle area is: 50.0

Enter rectangle length: 0
Enter rectangle width : 5
The rectangle dimensions are: 0.0 x 0.0
The rectangle area is: 0.0


Return to Fundamental's Home Page

Copyright: Ó1999 by the Austin Community College

Department of Computer Studies. All rights reserved.

Comments to: Bob Comer

Last updated: July 5, 1999