Guest User

Freight Sample

a guest
Sep 28th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. class freight
  2. {
  3.     public:
  4.         freight(string set_address, float set_length, float set_width, float set_height, float set_weight);
  5.         string address;
  6.         float length;
  7.         float width;
  8.         float height;
  9.         float weight;
  10.         float cost;
  11. };
  12.  
  13. class satchel: public freight
  14. {
  15.     public:
  16.         satchel(string set_address, float set_length, float set_width, float set_height, float set_weight);
  17. };
  18.  
  19. freight::freight (string set_address, float set_length, float set_width, float set_height, float set_weight)
  20. {
  21.     address = set_address;
  22.     length = set_length;
  23.     width = set_width;
  24.     height = set_height;
  25.     weight = set_weight;
  26. }
  27.  
  28. satchel::satchel (string set_address, float set_length, float set_width, float set_height, float set_weight) : freight (set_address, set_length, set_width, set_height, set_weight)
  29. {
  30.     cost = weight*1.20;
  31. }
  32.  
  33. carton::carton (string set_address, float set_length, float set_width, float set_height, float set_weight) : freight (set_address, set_length, set_width, set_height, set_weight)
  34. {
  35.     cost = weight*1.80;
  36. }
  37.  
  38. pallet::pallet (string set_address, float set_length, float set_width, float set_height, float set_weight) : freight (set_address, set_length, set_width, set_height, set_weight)
  39. {
  40.     cost = weight*2.50;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment