(C++ ARRAYS TASK!) The transport company transports cargo from Vilnius to Klaipeda. Manufacturers load goods into containers. Only products from one manufacturer are loaded in one container. There may be incomplete containers. The goods of a particular manufacturer are loaded into the container until they are exhausted or the container is filled. Products of all manufacturers are the same size (i.e. the container holds the same amount of products). Develop a program that calculates the minimum number of containers needed for all products and determines how many of these containers will be filled. For example, if a container holds 6 products, you will need to find how many containers will be needed, several containers will be filled (6 products), five products will be on the roads, four, three, two on the roads and only one product on the roads. The original data is saved in a text file. The first line contains two integers: the number of producers n (1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Containers (C++ ARRAYS TASK!)

The transport company transports cargo from Vilnius to Klaipeda. Manufacturers load goods into containers. Only products from one manufacturer are loaded in one container. There may be incomplete containers. The goods of a particular manufacturer are loaded into the container until they are exhausted or the container is filled.

Products of all manufacturers are the same size (i.e. the container holds the same amount of products).

Develop a program that calculates the minimum number of containers needed for all products and determines how many of these containers will be filled.

For example, if a container holds 6 products, you will need to find how many containers will be needed, several containers will be filled (6 products), five products will be on the roads, four, three, two on the roads and only one product on the roads.

The original data is saved in a text file. The first line contains two integers: the number of producers n (1 <n <1000) and the container capacity (1 <g <100). The following n lines record how many products each manufacturer wants to take to Klaipeda. These are integers from 1 to 1000.

The results are saved in a text file. The first line must indicate the number of containers that will be needed to transport all the products. In the following lines, the numbers of containers must be listed in descending order of the quantity of products in the containers.

 

______________________________________________

(Explanation that couldn't fit in the image)

There is 1 manufacturer, one container holds 5 products, 26 products need to be transported

This will require 6 containers, of which 5 will be completely filled (i.e. they will contain 5 products each) and 1 container will be half empty - it will contain only 1 product.

INITIAL DATA
RESULTS
EXPLANAITION
15
Provided below
26
5 4
14
15
because i couldnt fit
22
3
1
o un o o O
H922N 1
Transcribed Image Text:INITIAL DATA RESULTS EXPLANAITION 15 Provided below 26 5 4 14 15 because i couldnt fit 22 3 1 o un o o O H922N 1
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY