Code in C++ Must show: unit testing ------------------------------------ UsedFurnitureItem Create a class named UsedFurnitureItem to represent a used furniture item that...

90.2K

Verified Solution

Question

Programming

Code in C++

Must show: unit testing

------------------------------------

UsedFurnitureItem

  1. Create a class namedUsedFurnitureItem to represent a usedfurniture item that the store sells.
  2. Private data members of aUsedFurnitureItem are:
    1. age (double) // age in years – default valuefor
    2. brandNewPrice (double) // the original priceof the item when it was brand new
    3. description (string) // a string descriptionof the item
    4. condition (char) // condition of the itemcould be A, B, or C.
    5. size (double) // the size of the item in cubicinches.
    6. weight (double) // the weight of the item inpounds.
  3. Private member functions of aUsedFurnitureItem object are
    1. double CalculateCurrentPrice( ): Current pricedepends on age, brandNewPrice, and condition ofthe used furniture Item. If the item is in A-condition, the currentprice will go down by extra 10% of thebrandNewPrice for each year of its age until 7years (e.g., After the first year, and item with a $100brandNewPrice will cost $90, after 2 years, $ 80,and so on). If the age is greater than 7 years, the price is fixedat 30% of the brandNewPrice. The current price ofB-condition items goes down by extra 15 % of thebrandNewPrice for each year until the5th year. After that, the current price is fixed at 20%of the brandNewPrice. Items with C-condition arepriced at 10% of the brandNewPrice regardless ofage.
    1. double CalculateShippingCost( ): Shipping costof a UsedFurnitureItem depends on weight, size,and distance. While weight and size are member variables, shippingdistance is provided as an additional argument to this function.Shipping rate is 1 cent per mile for items that are smaller than1000 cubic inches and smaller than 20 pounds. Items with largersize or weight cost 2 cents per mile.
  4. Public member functions of aUsedFurnitureItem
    1. Constructors – default and overloaded [default values: age =1.0, brandNewPrice = 10.00, description = “Not available”,condition = ‘A’, size = 1.0, weight = 1.0]
    2. Accessors (getters)
    1. Mutators (setters) – You should ensure that invalid (zero ornegative) values do not get assigned to age,brandNewPrice, size orweight data members. An invalid character (otherthan ‘A’, ‘B’ or ‘C’) should not be allowed to be assigned

-------------------------------------

Test Program:

The test program will test each setter (for objects of bothtypes in a sequence) by calling the setter to set a value and thencall the corresponding getter to print out the set value. This testshould be done twice on data members that could be set to invalidvalues (that have numerical or character data type) – once aftertrying to set invalid values and subsequently, once after settingthem to valid values. The data members with string data types(model, description) can betested just once.

Answer & Explanation Solved by verified expert
4.3 Ratings (616 Votes)
include include using namespace stdclass UsedFurnitureItemprivate Declaring instance variablesdouble agedouble brandNewPricestring descriptionchar conditiondouble sizedouble weightpublic Zero argumented    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students