Computational Physics Laboratory PHZ4151C/PHZ5156C
  Spring 2009

  Class Meetings: HCB 0219, Tuesday and Thursday from 2:00 to 3:15 PM

  Office Hours: Wednesday 4:00 - 5:00 or upon appointment

  Course Text: David Yevick, A First Course in Computational Physics and Object-Oriented Programming with C++

Introduction to C++ Object-Oriented Programming


Write a program that contains a class Rectangle with two private double precision members iLength and iWidth, public set and get member functions for these two members, a two-argument constructor that sets the length and width to any two user-specified values, and a function area() that computes the area.


Example:
> ./project6

Output:
The area of the rectangle with width = 20 and length = 10 is 200.

Length = 30
Width = 20

The area of the rectangle with width = 20 and length = 30 is 600.

Source Code