4. A jeweler and her apprentice make silver pins and necklacesby hand. Each week
ID: 2916716 • Letter: 4
Question
4. A jeweler and her apprentice make silver pins and necklacesby hand. Each week they 80 hours of labor and 36 ounces of silveravailable. It requires 8 hours and 2 ounces of silver to make a pinand 10 hours of labor and 6 ounces of silver to make a necklace.Each pin also contains a small gem of some kind. The demand forpins is no more than six per week. A pin earns the jeweler $400 inprofit, and a necklace earns $100. The jeweler wants to know howmany of each item to make each week to maximize profit.
a. Formulate an integer linearprogramming model for this problem.
b. Solve this model by using thecomputer. Computer this solution with the solution without integerrestrictions and indicate whether the rounded-down solution wouldhave been optimal.
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
int x1 = 0;
int x2 = 0;
int profit = 0;
for(int i = 1; i <= 12; i++)
for(int j = 1; j <= 36; j++)
{
if(i%2 != 0 || j%6 != 0)
continue;
if((i*8 + j*10) > 80)
continue;
if( (i*400 + j*100) > profit)
{
profit = i*400 + j*100;
x1 = i;
x2 = j;
}
}
cout <<"Pins: " << x1 << endl << "Necklaces: " <<x2 << endl;
cout << "Profit: " << profit<< endl << endl;
system("pause");
return 0;
}
//Pins: 2, Necklaces: 6, Profit:1400
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.