Question

language C++ Write a program to handle the flow of widgets into and out of a...

language C++

Write a program to handle the flow of widgets into and out of a warehouse. The warehouse will have numerous deliveries of new widgets and orders for widgets. The widgets in a filled order are billed at a profit of 50 percent over their cost. Each delivery of new widgets may have a different cost associated with it. The accountants for the firm have instituted a last-in, first-out system for filling orders. This means that the newest widgets are the first ones sent out to fill an order. Also, the most recent orders are filled first. This function of inventory can be represented using two stacks: orders-to-be-filled and widgets-on-hand. When a delivery of new widgets is received, any unfilled orders (on the orders-to-be-filled stack) are processed and filled. After all orders are filled, if there are widgets remaining in the new delivery, a new element is pushed onto the widgets-onhand stack. When an order for new widgets is received, one or more objects are popped from the widgets-on-hand stack until the order has been filled. If the order is completely filled and there are widgets left over in the last object popped, a modified object with the quantity updated is pushed onto the widgets-on-hand stack. If the order is not completely filled, the order is pushed onto the orders-to-be-filled stack with an updated quantity of widgets to be sent out later. If an order is completely filled, it is not pushed onto the stack. Write a class with functions to process the shipments received and to process orders. After an order is filled, display the quantity sent out and the total cost for all widgets in the order. Also indicate whether there are any widgets remaining to be sent out at a later time. After a delivery is processed, display information about each order that was filled with this delivery and indicate how many widgets, if any, were stored in the object pushed onto the widgets-on-hand stack.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

solution:-

//Header files selection

#include <iostream>

#include <cstdlib>
#include <string>

#include <stack>

using namespace std;

class widget

{

public:

Widget(double newCost, int newQuantity);  
   double getCost();
   int getQuantity();      
   void setQuantity(int newQuantity);

private:

double quantity;

double cost;

};

Widget::Widget(double newCost, int newQuantity)
{  
   cost = newCost;
   quantity = newQuantity;
}

double Widget::getCost()
{
   return cost;
}

int Widget::getQuantity()
{
   return quantity;
}

void Widget::setQuantity(int newQuantity)
{
   quantity = newQuantity;
}


class Order
{
public:

Order(int newOrderNumber, int newQuantityToBeFilled);
   int getOrderNumber();
   int getQuantityToBeFilled();
   int getCompletedQuantity();
   double getCompletedTotalPrice();
   void setQuantityToBeFilled(int newQuantityToBeFilled);

private:
   int orderNumber;
   int quantityToBeFilled;
   int completedQuantity;
   double completedTotalPrice;
};

Order::Order(int newOrderNumber, int newQuantityToBeFilled)
{
   orderNumber = newOrderNumber;
   quantityToBeFilled = newQuantityToBeFilled;
}

int Order::getOrderNumber()
{
   return orderNumber;
}

int Order::getQuantityToBeFilled()
{
   return quantityToBeFilled;
}

int Order::getCompletedQuantity()
{
   return completedQuantity;
}

double Order::getCompletedTotalPrice()
{
   return completedTotalPrice;
}

void Order::setQuantityToBeFilled(int newQuantityToBeFilled)
{
   quantityToBeFilled = newQuantityToBeFilled;
}


class Warehouse
{
public:
   Warehouse();
   void processShipmentsReceived();
   void processOrders();

private:
   stack<Widget> widgets_on_hand;
   stack<Order> orders_to_be_filled;
   int numberOfWidgetsInStock;

};

Warehouse::Warehouse()
{}

void Warehouse::processShipmentsReceived()
{
   double cost;
   int quantity;
   int orderFilledWithDelivery;
   int numberOfWidgetsToBeStored;
  
   cout << "Enter the cost of widget (0 or less for exit): ";
   cin >> cost;
  
   while (cost <= 0)
   {
       cout << "Enter the quantity of widget: ";
       cin >> quantity;
      
       Widget w(cost, quantity);
       widgets_on_hand.push(w);

       cout << "Enter the cost of widget (0 or less for exit): ";
       cin >> cost;
   }
}

void Warehouse::processOrders()
{
   double totalCostToCustomer = 0;
   double profit = 0;
   double costOfWidgetsToWarehouse = 0;
   int orderNumber;
}


int main()
{
   Warehouse house;

   int choice;

   do
   {
       cout << "*** MENU ***" << endl;
       cout << "1. Make a delivery of widgets" << endl;
       cout << "2. Meke an order for widgets" << endl;
       cout << "3. Exit" << endl;
       cout << "Enter your choice: ";
       cin >> choice;

       switch (choice)
       {
       case 1:
           house.processShipmentsReceived();
           break;

       case 2:
           house.processOrders();
           break;

       case 3:
           cout << "Thank yo
u" << endl;
           break;

       default:
           cout << "Invalid choice!" << endl;
       }

   } while (choice != 3);

   cout << endl << endl;  
   return 0;
}

   int numberOfWidgetsShipped;
};

thanks....

please give me thumb up........................

Add a comment
Know the answer?
Add Answer to:
language C++ Write a program to handle the flow of widgets into and out of a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a JAVA program to monitor the flow of an item into an out of a...

    Write a JAVA program to monitor the flow of an item into an out of a warehouse. The warehouse has numerous deliveries and shipments for this item (a widget) during the time period covered. A shipment out (an order) is billed at a profit of 50% over the cost of the widget. Unfortunately each incoming shipment may have a different cost associated with it. The accountants of the firm have instituted a last-in, first out system for filling orders. This...

  • Using: C# Inventory Management System Objective: Work with multiple objects and reading data files. Description: A...

    Using: C# Inventory Management System Objective: Work with multiple objects and reading data files. Description: A wholesale distributor has six warehouses (Atlanta, Baltimore, Chicago, Denver, Ely and Fargo) and sells five different items (identified by part number: 102, 215, 410, 525 and 711). Each warehouse may stock any or all of the five items. The company buys and sells these items constantly. Company transaction records contain a transaction code (‘P’ for a purchase or ‘S’ for a sale) followed by...

  • Write In C program Bart Simpson is a pharmacist and likes to handle his customers' request...

    Write In C program Bart Simpson is a pharmacist and likes to handle his customers' request as soon as possible. The customer who comes first get their prescription filled first. Write a menu-based program that helps Bart Simpson fill prescription order queue shown here: Name Angie Bertha Charlie Medication Lipitor Nexium Epogen The prescription queue is empty when the program starts. The menu should be as follows. Your choice is managed by switch statement and each choice requires a separated...

  • write a C program that evaluate algebraic expressions over real numbers in Reverse Polish Notation (RPN)

    Your program must evaluate algebraic expressions over real numbers in Reverse Polish Notation (RPN). + (addition), - (subtraction), * (multiplication) and / (division) should be treated as arithmetic operations. Depending on the selection, numerical values must be entered and displayed in decimal, hexadecimal or binary form. Example: The expression ((3+4) *(7+1.6-12) -5) / (3-8.7)Will be calculated on your RPN calculator as 3 4 + 7 1.6 + 12 - * 5 - 3 8.7 - / Your RPN computer's user...

  • Hello I need help to figure out the MIN Inventory for my stimulation game. I got...

    Hello I need help to figure out the MIN Inventory for my stimulation game. I got the daily ending inventory but how do I get the min inventory and total capactiy needed in excel. For example, I got my available capacity of 20, and the daily ending inventory by taking the beginning inventory-the demand+available capacity. But I'm not sure how to calculate min inventory and total capacity needed in excel. Also can you please help with Order point below. thank...

  • Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders...

    Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders that come in. This program will require multiple classes. Summary class, customer class, order class and the driver class. Summary class This class will keep track of the cost of the order and output a summary, which includes the total for the order. The methods in this class are static. There are no instance variables, and instead uses an Order object that is passed...

  • 3.4 Beccan Company is a discount tine dealer operating 25 retail stores in a large metro...

    3.4 Beccan Company is a discount tine dealer operating 25 retail stores in a large metro politan area. The company purchases all tires and related supplies using the company's central purchasing department to optimize quantity discounts. The tires and supplies are received at the central warehouse and distributed to the retail stores as needed. The perpetual inventory system at the central facility maintains current inventory records, designated reorder points, and optimum order quantities for each type and size of time...

  • The Code need to be in C# programming language. could you please leave some explanation notes...

    The Code need to be in C# programming language. could you please leave some explanation notes as much as you can? Thank you Create the following classes in the class library with following attributes: 1. Customer a. id number – customer’s id number b. name –the name of the customer c. address – address of the customer (use structs) d. telephone number – 10-digit phone number e. orders – collection (array) of orders Assume that there will be no more...

  • Sultona check the flow Mid-term Analysis #3: Last year, Gold Rock LLC. purchased over $10 million...

    Sultona check the flow Mid-term Analysis #3: Last year, Gold Rock LLC. purchased over $10 million worth of office equipment under its "special ordering system, with individual orders ranging from $5,000 to $30,000. Special orders are for low- volume items that have been included in a department manager's budget. The budget, which limits the types and dollar amounts of office equipment a department head can requisition, is approved at the beginning of the year by the board of directors. The...

  • Part #1: Elegance - Women and Men (LLC) Elegance Women and Men (LLC) is a rapidly...

    Part #1: Elegance - Women and Men (LLC) Elegance Women and Men (LLC) is a rapidly growing luxury lifestyle brand led by a talented and ambitious management team. The company features distinctive designs, materials and craftsmanship with a jet-set aesthetic that combines stylish elegance and a sporty attitude.. The company aims to provide American top luxury clothing and accessories including handbags, small leather goods, eyewear, jewelry and watches and footwear in three segments-retail, wholesale and licensing. Elegance plans to go...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT