Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Statistics and Probability Expert

Consider the change-counting program of section 1.2.2. It would be nice to be able to easily change the currency used by the program, so that we could compute the number of ways to change a British pound, for example. As the program is written, the knowledge of the currency is distributed partly into the procedure first-denomination and partly into the procedure count-change (which knows that there are five kinds of U.S. coins). It would be nicer to be able to supply a list of coins to be used for making change.

We want to rewrite the procedure cc so that its second argument is a list of the values of the coins to use rather than an integer specifying which coins to use. We could then have lists that defined each kind of currency
(define us-coins (list 50 25 10 5 1)) (define uk-coins (list 100 50 20 10 5 2 1 0.5))

We could then call cc as follows:
(cc 100 us-coins) 292
To do this will require changing the program cc somewhat. It will still have the same form, but it will access its second argument differently, as follows:

1836_kk.jpg

Define the procedures first-denomination, except-first-denomination, and nomore? in terms of primitive operations on list structures. Does the order of the list coin-values affect the answer produced by cc? Why or why not?

 

Statistics and Probability, Statistics

  • Category:- Statistics and Probability
  • Reference No.:- M91767618

Have any Question?


Related Questions in Statistics and Probability

A shipment contains 11 tvs of which two are defective a

A shipment contains 11 TV's, of which two are defective. A sample of three TV's is selected at random. In how many ways can no defective TV's be chosen?

Interested in learning more about its fans the marketing

Interested in learning more about its fans, the marketing office of the Arena Football League (AFL) conducted a survey at one of its games. The survey had 952 respondents, 679 males and 273 females. Out of the 952 total ...

A random sample of 12 parts from factory a has an average

A random sample of 12 parts from factory A has an average reliability of 4.48 with a sample standard deviation of 3.19. A random sample of 15 products from factory B has an average reliability of 2.36 with a sample Stand ...

The jo supplies company buys calculators from a korean

The J.O. Supplies Company buys calculators from a Korean supplier. The probability of a defective calculator is 20%. If 15 calculators are selected at random, what is the probability that less than 5 of the calculators w ...

New varieties of corn with altered amino acid content are

New varieties of corn with altered amino acid content are being investigated for higher nutritional content. The two new varieties, opaque-2 and floury-2, were to be compared to the normal corn. Also different levels of ...

1 suppose that in the game of afl the mean total number of

1. Suppose that in the game of AFL the mean total number of points per match is 185 with a standard deviation of 33. Suppose that a season involves 202 matches. If the total points are normally distributed then answer th ...

Consider the following cash flowsyear cash flow0 -59001

Consider the following cash flows: Year Cash Flow 0 -$5,900 1 2,000 2 2,700 3 1,500 4 900 What is the payback period for the above set of cash flows? In years

A laboratory worker finds that the 3 of his blood samples

A laboratory worker finds that the 3% of his blood samples test positive for the HIV virus. In a random sample of 70 blood tests, what is the mean number that test positive for the HIV virus? (Round your answer to 1 deci ...

Question 1below you are given the examination scores of 20

Question 1 Below you are given the examination scores of 20 students (data set also provided in accompanying MS Excel file). 52 99 92 86 84 63 72 76 95 88 92 58 65 79 80 90 75 74 56 99 a. Construct a frequency distributi ...

You are considering an investment in a 40-year security the

You are considering an investment in a 40-year security. The security will pay $25 a year at the end of each of the first three years. The security will then pay $30 a year at the end of each of the next 20 years. The no ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As