Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in C++ which creates class named as · Item This class should con

ID: 3616829 • Letter: W

Question

Write a program in C++ which creates class named as

·       Item   

This class should contain following members

o       stock   //for stockquantity of a certain item

o       quantitypurchased    //for quantity to be purchased in acustomer’sorder        

o       Order()          //for checking whether order can be placed or not.

This can be checked by comparingquantity_purchased with stock. If the quantity to be purchased ismore than the stock; an exception should be thrown.

To throw exception, you need tocreate another class named as

·       Exception

In main create an object ofclass Item and call the order method inside the try block. You cancheck in the definition of the method order () whether stock isless than quantity purchased. If it is true, then throw exceptionthat displays message saying;

     There is not enough stock

On the other hand if stock is morethan quantity purchased then you need to display appropriatemessage saying;

        Therequired quantity of item is available in thestock

Sample Output1:

There is not enough stock  

(if the stock is less than quantitypurchased)

Sample Output2:

The required quantity of item is available in thestock      

(if the stock is greater than or equal to thequantity purchased)

please friends help me

==========================================================

Explanation / Answer

#include #include class item{       private:              int getstac,ord,quil;      public:                          void stock()       {            intgetstac=400;            }            voidquality()            {                int quil=400;                }                void order()                {                     int ord;                     coutord;                     if(ord>=400)                     {                           cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote