Assignment
1 Description
You are a tourist visiting the planet Zondor and, since you are unfamiliar with Zondorian coins, you are burdened by way too many of them. The next time you buy something, you are determined to use as many of your coins as possible, and want to give the vendor exact change so you won’t receive any more coins as change.
For this problem, the Zondorian coins have integer values z1, z2, . . . , zn and you can assume that you have a limitless number of each coin. When you purchase something of value Y ,
you want to determine the maximum number of coins you can give to purchase the item with exact change (you may return some dummy value, -1, 0, ±∞, if it is not possible to exactly
match Y ). For example, if (z1, z2, z3) = (3, 7, 11) and Y = 25, you could get rid of 3 coins (3, 11, 11) or, better, 7 coins (3, 3, 3, 3, 3, 3, 7).
This programming assignment is to implement a modification of the MaxZondorCoin problem on the above description. In this case you have
coins of denominations d1, d2, . . . , dn
a target value T
where all denominations are distinct
and you have 5 coins of each denomination
Write code that will determine the maximum number of coins that will add up to the target value
T (exactly).
You may write your program in either Java, Python, C, or C++
2 Input Format
The input will be a text file. The the first line has integers n and m, where n is the number of coins and m is the number of target values T to be tested. After the first line are n lines containing a single integer, the denomination of each coin. These numbers will be distinct. After these there will be m lines of a single integer T , each to be tested against the coin set given in the first n lines.
3 Example
input: from file inSample.txt
3 8
3
7
1
11
0
3
21
22
72
104
105
106
output:
target: 0, max coins: 0
target: 3, max coins: 1
target: 21, max coins: 3
target: 22, max coins: 6
target: 72, max coins: 12 target: 104, not possible target: 105, max coins: 15 target: 106, not possible
4 Testing Protocol
We will test your program by running your program at the command line. You will need to use standard input. Do not pass in the name of the file as an argument - do not encode the name of your input file in your program. We will run your program on several different test files, some of which may be generated by other programs and piped into yours.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of