Itcs 2530 Chapter 10 Class Exercise Class Cweight Private Int Pounds Ounces Public Cweight Q37074537

ITCS 2530 Chapter 10 Class Exercise

Class CWeight
{
private:
               int pounds, ounces;
public:
               CWeight(int lb = 0, int oz = 0);    //combined default and argument constructor
               void setWt ();                  //prompt for and get input for pounds and ounces
               void setWt (int lb, intoz);            //sets current object with parameter lb and oz
               void showWt ( ) const;   //display current object’spounds and ounces
               
int getPounds( ) const;   //returns pounds
               
int getOunces ( ) const; //returns ounces
               CWeight addWt ( const CWeight& wt)const;      
               //add current object and parameter wt and return thetotal
               //to add: add pounds to pounds and ounces to ounces withoutadjusting

               CWeight subtractWt (const CWeight& wt) const;
               //subtract parameter wt from current object and return thedifference
               //to subtract: subtract pounds

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.