Page 1 of 1

Please use stacks in it. Please use c++. Thanks Please use the attached header files for this assignment. Don’t make an

Posted: Mon Jun 06, 2022 4:59 pm
by answerhappygod
Please use stacks in it. Please use c++. Thanks
Please use the attached header files for this
assignment. Don’t make any change to the name of the files or
functions. You just need to implement ProcessOrders.cpp based
on the three header files that you are given for this
assignment. You also must submit a cxxtest program similar to
the running examples to test your program. Use the examples
to verify your program works. But use different quantities
and cost values for the shipments or orders in your cxxtest program
when you submit the assignment.
Inventory.h
#ifndef SHIPMENT_H_
#define SHIPMENT_H_
/** Class to model a shippment of Widgets */
class Inventory {
public:
/** Class constructor. Creates a new instance of Shipment.
@param q Quantity (number) of widgets in
shipment
@param c Cost of the widgets in shipment
*/
Inventory(int q, double c):
quantity(q), cost(c) {}
// Accessor methods
int get_quantity() const
{return quantity;}
double get_cost() const
{return cost;}
//Modifier method
void set_quantity(int q)
{quantity = q;}
private:
int quantity;
double cost;
};
#endif
order.h
#ifndef ORDER_H_
#define ORDER_H_
/** Class to model an Order for Widgets */
class Order{
public:
/** Class constructor. Creates a new instance of Order.
@param q Quantity (number) of widgets requested
in Order
*/
Order(int q): quantity(q){}
//Accessor method
int get_quantity() const
{return quantity;}
/Users/jineshpatel/Desktop/Order.h
//Modifier method
void set_quantity(int q)
{quantity = q;}
private:
int quantity;
};
#endif
ProcessOrder.h
#ifndef PROCESSORDERS_H_
#define PROCESSORDERS_H_
#include
#include "Inventory.h"
#include "Order.h"
class ProcessOrders
{
public:
/** Process new Shipment
@param q Quantity of widgets in shipment
@param c Cost of the widgets in shipment
Also process any un-filled orders in the orders_to_be_filled
stack
@return total amount that were processed from
orders_to_be_filled stack
*/
double process_shipment(int q,
double c); // process shipments arrive; return
total shipment
/** Process new Order
@param q Quantity of widgets in shipment
@return total amount that were processed from
orders_to_be_filled stack
*/
double process_order(int q);
// process orders
// void do_shipment_arrived(); // get inputs from user when the
shipments arrive
// void do_order_arrived(); // get inputs from user when the
orders arrive
private:
std::stack Inventory_on_hand; // keep track of inventory on
hand
std::stack orders_to_be_filled; // keep track of orders
};
#endif /* PROCESSORDERS_H_ */