# Gifting Problem  Problem statement: Suppose you are in charge of a non-profit organization that receives don

Problem statement:

Suppose you are in charge of a non-profit organization that receives donated gifts and distributes them to
needy children. You are given a list of children with their ages (0 to 16 years old).
For each gift, you are given the following information:
Retail price
Range of suitable ages

Let: P = sum of retail prices of the gifts
N = total number of children
ei = | P/N – sum of retail prices for gifts given to child i |
You must minimize Σ ei  for the N children, subject to the following constraints:
1. Each gift must be given to exactly one child.
2. No child may be given a gift that is not intended for their age.
3. Each child must receive at least one large and one medium gift, where 1 ft3 <= medium gift <= 2 ft3, and
4. The number of gifts received by each child can be no less than the average – 1 and no more than the
average + 1.

Important:
The sum of the e_i values MUST be the absolute lowest value that is possible for the given input file.

Rubric:
Compiles, good programming style, processes command line arguments 15 pts.
Produces  correctly  formatted  output  file  with  all  children  and  gifts  included  10  pts.
Produces optimal solution 70 pts.
Compute time/space efficiency, creativity 5 pts. + extra credit possible
Notes:
1. Extra credit could possibly be large
2. Programming style based on Department Standards (see Programming Standards file on Canvas)
3. A signed Academic Integrity statement must be submitted to receive credit
Programs that do not compile and produce an executable on Clark will not be graded
Programs MUST be written in C/C++

Input format:

Plain text tab-delimited file. See example on next page. Child1 age 8
Child2 age 6
Child3 age 4

G1 12 1.3 7-14
G2 15 2.5 any
G3 8 1.5 0-5
G4 22 2.8 6-16
G5 10 1.5 any
G6 11 2.1 any

Output format:

The output should be a plain text tab-delimited file. It must begin with ‘Sum_e_i x’, where x is the sum of the ei
values. This should be followed by N rows, one for each child (in order), with their assigned gifts and ei value
as follows:

Sum_e_i 12.0
Child1 G1 G6 3
Child2 G5 G4 6
Child3 G3 G2 3

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.