JJohnson1701
New member
- Joined
- Sep 17, 2018
- Messages
- 3
- Programming Experience
- 1-3
Hi everyone,
I'm trying to help out a friend on some C# and I'm stumped here.
The issue is to show the proper sort for a series of classes representing a warehouse order. I found out the right order in Excel, but we need to show it program-wise.
The skeleton program is:
And the classes are here:
If anyone knows how to proceed here, I would greatly appreciate it.
I'm trying to help out a friend on some C# and I'm stumped here.
The issue is to show the proper sort for a series of classes representing a warehouse order. I found out the right order in Excel, but we need to show it program-wise.
The skeleton program is:
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WarehouseOptimization
{
class Program
{
static void Main(string[] args)
{
/*
* WAREHOUSE OPTIMIZATION
*
* Please do not post your solution to this problem online (Git, etc.) Please keep the solution
* in Dropbox folder we shared with you.
*
* At ACME warehouse the warehouse manager has observed orders taking a long time to pick and
* believes that moving more popular items to easier to access locations may help.
*
* - Workers pick an order by placing items on a pallet at the dock door.
* - Products are stored (inefficiently) in a single aisle with multiple shelves.
* - As the shelf number increases, it is located further down the aisle and
* further away from the dock door.
* - On average it takes 5*X seconds for a warehouse worker to retrieve an item
* from shelf X and place it on the pallet.
* - A warehouse worker can only carry a single item at a time.
* - A shelf can only hold one type of item.
*
* Which items should be on which shelves to optimize picking speed based on
* yesterday's orders?
*
*
* Example output
*
* Shelf 1: Item 12
* Shelf 2: Item 11
* Shelf 3: Item 10
* Shelf 4: Item 09
* Shelf 5: Item 08
* Shelf 6: Item 07
* Shelf 7: Item 06
* Shelf 8: Item 05
* Shelf 9: Item 04
* Shelf 10: Item 03
* Shelf 11: Item 02
* Shelf 12: Item 01
*
*/
OrderRepository orderRepo = new OrderRepository();
// write your code here
Console.WriteLine("Order " + Order[1].OrderLine[1]);
And the classes are here:
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WarehouseOptimization
{
public class Order
{
public OrderLine[] orderLines;
public int id;
public string customerName;
}
public class OrderLine
{
public int quantity;
public string itemName;
}
public class OrderRepository
{
public Order[] GetYesterdaysOrders()
{
Order[] orders = new Order[] {
new Order{
id = 1,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 01", quantity = 1},
new OrderLine{ itemName = "Item 02", quantity = 3},
new OrderLine{ itemName = "Item 03", quantity = 25},
new OrderLine{ itemName = "Item 04", quantity = 12},
},
},
new Order{
id = 2,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 01", quantity = 1},
new OrderLine{ itemName = "Item 08", quantity = 42},
new OrderLine{ itemName = "Item 09", quantity = 13},
new OrderLine{ itemName = "Item 12", quantity = 37},
},
},
new Order{
id = 3,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 12", quantity = 16},
},
},
new Order{
id = 4,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 10", quantity = 11},
new OrderLine{ itemName = "Item 11", quantity = 10},
},
},
new Order{
id = 5,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 06", quantity = 7},
new OrderLine{ itemName = "Item 07", quantity = 2},
new OrderLine{ itemName = "Item 12", quantity = 14},
},
},
new Order{
id = 6,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 05", quantity = 17},
},
},
new Order{
id = 7,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 03", quantity = 5},
new OrderLine{ itemName = "Item 07", quantity = 2},
},
},
new Order{
id = 8,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 02", quantity = 13},
new OrderLine{ itemName = "Item 07", quantity = 7},
new OrderLine{ itemName = "Item 09", quantity = 2},
},
},
new Order{
id = 9,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 01", quantity = 4},
new OrderLine{ itemName = "Item 06", quantity = 17},
new OrderLine{ itemName = "Item 07", quantity = 3},
},
},
new Order{
id = 10,
orderLines = new OrderLine[] {
new OrderLine{ itemName = "Item 11", quantity = 12},
new OrderLine{ itemName = "Item 12", quantity = 1},
},
},
};
return orders;
}
}
}
If anyone knows how to proceed here, I would greatly appreciate it.