$24
Files to submit: heist.c
Time it took Matthew to Complete: 15 mins
All programs must compile without warnings when using the -Wall and -Werror options
Submit only the files requested
Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc
Your program must match the output exactly to receive credit.
Make sure that all prompts and output match mine exactly.
Easiest way to do this is to copy and paste them
All input will be valid unless stated otherwise
Print all real numbers to two decimal places unless otherwise stated
The examples provided in the prompts do not represent all possible input you can receive.
All inputs in the examples in the prompt are underlined
You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
If you have questions please post them on Piazza
Restrictions
No global variables are allowed
Your main function may only declare variables, call other functions, and assign variables values.
You must solve this problem recursively
Your college loans are really high and you have fallen on hard times. In order to get the money to pay them off you are considering robbing a jewelry store. You've recorded the weight and value of each item and you are are planning on bringing your favorite backpack with you to carry off the loot. You want to walk out the store with your backpack containing the maximum value possible and so have decided to write a program to help you figure out what the value of that backpack is.
Specifications
Your program should ask the user for the following information in this order
The maximum amount of weight their bag can hold
The number of items in the jewelry store
The value and weight of each item
Hints
In order to solve this problem you should try out every possible valid combination of items that will fit in the backpack and then see which backpack is the most valuable.
Examples
Enter the maximum amount of weight that your bag can hold: 100
Enter the number of items that are in the jewelry store: 3 Enter your items, one per line (value weight):
47 10
50 97
45 5
They most profitable heist will net you $92 in total.
Enter the maximum amount of weight that your bag can hold: 100
Enter the number of items that are in the jewelry store: 4 Enter your items, one per line (value weight):
24 33
14 62
22 23
1200 99
They most profitable heist will net you $1200 in total.