Assignment_8 - Computer Science G175 - C+ Programming...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science G175 - C++ Programming Assignment 8 Assignment_8.cpp (3 points) Create a class rectangle . The class should have data members length and width of type float , each of which defaults to 1. The class should have member functions that calculate the perimeter() and the area() of the rectangle. It should also have separate set() and get() functions for both the length and width ( set_length(), get_length(), set_width(), get_width() ). The set_length() and set_width() functions should require the user to enter length or width data values greater than zero and less than or equal to 20.0. These functions should examine the data entered by the user, and accept the data only if it is in the specified range (0 < data <= 20.0). If the data is not in this range, the user should be reminded of the allowed data range and prompted to enter the data again. This cycle should repeat until the user enters a correct data value. This can be accomplished by using a do while loop in each set() function. The get() functions should be declared using the const keyword to ensure that these
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/07/2010 for the course CS 175 taught by Professor Mike during the Spring '06 term at Golden West College.

Ask a homework question - tutors are online