Sorry, but your question is very vague. Is this a knapsack type of problem? Is there an explanation for the dataset at the top of your post? Since you have the knowledge of how to find the minimum cost, are you only asking for a tutorial in programming? Programs are nothing more than a list of instructions given to a computer to execute.
Your homework problems will not be solved here unless you put forth some effort in explaining your questions and explaining where you become stuck in your program.