Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make sure the answer is clear, and if you can answer it with as least code as possible. And Btw this is a C++

image text in transcribed

Please make sure the answer is clear, and if you can answer it with as least code as possible. And Btw this is a C++ class.

Write a C++ class (not a class template) called Inventoryltem. Your class should include: - two private data members: id (an integer) quantity (an integer) - all member functions should be public. - a default (no argument) constructor that sets id and quantity to zero - an accessor method called getld that has no parameters and returns the value of the id data member. This should be a constant method. - An accessor method called getQuantity that has no parameters and returns the value of the quantity data member. This should be a constant method. - A method called setld that has one integer parameter. This method will store the value of the parameter in the id data member. - A method called add that can be used to increase the quantity of an inventory item. This method has a single integer parameter (say called num) and returns a boolean value If num is positive, data member quantity is incremented by num and the method returns true (update was successful). Othervise, the object is not modified and the method returns false (invalid - A method called remove that can be used to decrease the quantity of an inventory item. This method has a single integer parameter (say called num) and returns a boolean value. If num is request). positive and less than or equal to quantity, data member quantity should be decremented (decreased) by num and the method returns true (update was successful). Otherwise. the object is not modified and the method returns false (invalid request). Your class definition should contain only data fields and method prototypes. The implementations for your methods should be outside the class definition. Nrite you answer in the text box below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Explain exothermic and endothermic reactions with examples

Answered: 1 week ago

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago