1. Develop a class part. a. Private variables the class has: integer partnum; i. integer inventory; ili. double unitpric

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

1. Develop a class part. a. Private variables the class has: integer partnum; i. integer inventory; ili. double unitpric

Post by answerhappygod »

1. Develop a class part.
a. Private variables the class has:
integer partnum;
i. integer inventory;
ili. double unitprice;
b.Public functions:
i. constructor, with default argument that set all the three
internal
variables to 0 but allows the caller to give initial value when an
object is
created.
ii. instore(), which returns the inventory value.
ji. buy(), which has an integer parameter unit. It add the value of
the
parameter to the inventory. The function returns the cost to buy
the unit
number of parts (unit * unitprice).
iv. low/), it returns true or false. It returns true when the
inventory is less
than 1000.
v. operator overloading ==. Two parts are the same if their
inventory
amount is the same.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply