1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Kruka [31]
3 years ago
10

The price of an item you want to buy is given in dollars and cents. You pay for it in cash by giving the clerk d dollars and c c

ents. Write specifi cations for a function that computes the change, if any, that you should receive. Include a statement of purpose, the preconditions and postconditions, and a description of the arguments.
Mathematics
1 answer:
MrRa [10]3 years ago
8 0

Answer:

f(x,y) = \left \{ {(d-x,c-y) \, \, {y \, \leq c} \atop (d-x-1, 100+c-y) \, \, {y \, > \, c}} \right.

Where x is the amount of dollars the item costs and y is the amount of cents. The first entry of f(x,y) is the amount of dollars to be returned and the second entry is the amount of cents to be returned.

Step-by-step explanation:

let f(x,y) be the function that computes the change.

The parameter x is the amount of dollars it costs and y is the amount of cents. both x and y should be integers and both of them should be positive or 0. Also y must be lower than 100, and x cant be bigger than d. Also if x = d, then it must happen that y ≤ c. The return value f(x,y) is a pair (a,b) where a and b satisfies the same conditions than the ordered pair (x,y) (the change cant be higher than the amount paid). a represents the amount of dollars that has to be returned and b the amount of cents.

Now, lets go to the formula. The formula should depend on wether y is higher than d or not, if that is the case, then after substracting x from d, we need to substract one more and add 100 cents to c-y (because we cant be given negative cents)

f(x,y) = \left \{ {(d-x,c-y) \, \, {y \, \leq c} \atop (d-x-1, 100+c-y) \, \, {y \, > \, c}} \right.

You might be interested in
Write the ratio in simplest form.<br><br> 13
katovenus [111]

Answer:

1:3

Step-by-step explanation:

5 0
3 years ago
Read 2 more answers
What is the value of b in the equation brainly (y^-9)^b=y^45?
riadik2000 [5.3K]

Answer:

its -5 just took the test

Step-by-step explanation:


4 0
4 years ago
Read 2 more answers
Harry took out an 80/20 mortgage to buy a house costing $175,000. The first
STatiana [176]

Answer:

WEll the answer is d

Step-by-step explanation:

The first (80%) mortgage has an interest rate of 4.75%, and the second (20%) mortgage has an interest rate of 7.525%. Both are 30-year fixed-rate mortgages.

8 0
3 years ago
Read 2 more answers
Pls help me, I dont get the question. Polynomials
AnnZ [28]

The given polyn. is not in std. form. To answer this question, we need to perform the indicated operations (mult., addn., subtrn.) first and then arrange the terms of this poly in descending order by powers of x:

P(x) = x(160 - x) - (100x + 500)

When this work has been done, we get P(x) = 160x - x^2 - 100x - 500, or

P(x) = -x^2 + 60x - 500

So, you see, the last term is -500. This means that if x = 0, not only is there no profit, but the company is "in the hole" for $500.

6 0
3 years ago
What is the answer to x(4x+1)
Gekata [30.6K]
4x^2+x. you can look up the answer for confirmation pls mark me brainliest!!
8 0
3 years ago
Read 2 more answers
Other questions:
  • 7×8/10= the product lies between?
    13·1 answer
  • 2nd time posting this.. pls help :'(
    8·1 answer
  • a cartoon kid hold 1000 unit cubes that measure 1 inch by 1 inch by 1 inch describe the dimensions of the carton using unit cube
    5·1 answer
  • Ryan was adding numbers on a number line. He started at –3 and then he added +2. He wrote that his answer was –5 .
    13·1 answer
  • What is the property of the equation 3x+5 - 5 = 20-5
    13·1 answer
  • Janiah is solving the system using elimination. Her first step is shown. What should be her next step?
    10·2 answers
  • What time is it if half of what has already passed remains until the end of today?
    5·1 answer
  • A.<br> Area of a square: 81 in?
    15·2 answers
  • Please please please help me I’ll give brainly
    15·1 answer
  • PLEASE HELP! EXPLANATION NEEDED
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!