home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CPTUTOR2.ZIP / TRANSPRT.CPP < prev    next >
Text File  |  1990-07-20  |  947b  |  33 lines

  1.                                   // Chapter 7 - Program 3
  2. #include "iostream.h"
  3. #include "vehicle.hpp"
  4.  
  5. main()
  6. {
  7. vehicle car, motorcycle, truck, sedan;
  8.  
  9.    car.initialize(4, 3000.0);
  10.    motorcycle.initialize(2, 900.0);
  11.    truck.initialize(18, 45000.0);
  12.    sedan.initialize(4, 3000.0);
  13.    
  14.    cout << "The car has " << car.get_wheels() << " wheels.\n";
  15.    cout << "The truck has a loading of " << truck.wheel_loading()
  16.                   << " pounds per wheel.\n";
  17.    cout << "The motorcycle weighs " << motorcycle.get_weight() 
  18.                   << " pounds.\n";
  19.    cout << "The sedan weighs " << sedan.get_weight() 
  20.                   << " pounds, and has " << sedan.get_wheels() 
  21.                   << " wheels.\n";
  22. }
  23.  
  24.  
  25.  
  26.  
  27. // Result of execution
  28. //
  29. // The car has 4 wheels.
  30. // The truck has a loading of 2500 pounds per wheel.
  31. // The motorcycle weighs 900 pounds.
  32. // The sedan weighs 3000 pounds, and has 4 wheels.
  33.