How to solve the task Scheduler machines?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
13 views
Good day! At an impasse with the task. Here's the deal:
For our logistics Department was required to implement functionality that would show some order in what kind of car shipping.
Implement a simple class TruckPlanner, which would allow in a simple form to obtain the distribution of orders for machines. At this stage you need to solve the problem of optimal allocation of orders to reduce the number of cars.
Class description
Class TruckPlanner should accept in the constructor the following arguments:
1. weigthLimit — limit weight for all machines, the number.
Methods
An instance of the class TruckPlanner must be available one method:
• add — adds the order to the scheduler takes as argument order.
Meta-programming
An instance of the class TruckPlanner must implement an iterator which returns a machine Truck with distributed them with orders Order.
To implement the iterator must be used generator. To check again that the orders should be distributed on the machines, just consistently, subject to the limit, to optimize the distribution is not required.
The Order Class
The constructor takes two arguments:
1. id — the ID number;
2. weight — the weight of the order, the number.
Class Truck
The constructor takes two arguments:
1. number — serial number of the machine number;
2. weightLimit — limit weight, number.
Has the following properties and methods:
• property totalWeigth — the total weight of the orders, a number that is read-only.
• the add method places the order in the car, takes the order as the argument. Return 'true' if the order fits in the car, otherwise returns false.
• method isFit — check, whether to put the order in the car, takes the order as the argument. Return 'true' if the order fits in the car, otherwise returns false.

and here is my code what I have doesalso https://codepen.io/RatiboR1978/pen/bMBbog?editors=1011# I have created the load only those orders that it is wet from the entire list. How to create a second machine, and how to stop the download first when you start not to intermeddle orders, can't figure out.
by | 13 views

2 Answers

0 like 0 dislike
by
0 like 0 dislike
See on CodePen
The answer to your question in the add method of the class TruckPlanner
by

Related questions

0 like 0 dislike
1 answer
asked Aug 7, 2019 by jallvar
0 like 0 dislike
7 answers
0 like 0 dislike
3 answers
asked Jun 13, 2019 by Postal_black
0 like 0 dislike
3 answers
110,608 questions
257,186 answers
0 comments
35,573 users