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.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme
Get Free Quote!
422 Experts Online