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
jeka57 [31]
3 years ago
10

6.32 LAB: Exact change - functions

Engineering
1 answer:
Neko [114]3 years ago
5 0

Answer:

Below is the desired C++ program for the problem. Do feel free to edit it according to your preference

Explanation:

#include <iostream>

#include <vector>

using namespace std;

void ExactChange(int userTotal, vector<int> &coinVals) {

   coinVals.reserve(5);

   coinVals[0] = userTotal / 100;

   userTotal %= 100;

   coinVals[1] = userTotal / 25;

   userTotal %= 25;

   coinVals[2] = userTotal / 10;

   userTotal %= 10;

   coinVals[3] = userTotal / 5;

   userTotal %= 5;

   coinVals[4] = userTotal;

}

int main() {

   vector<int> coins;

   int value;

   cin >> value;

   if (value <= 0) {

       cout << "no change" << endl;

   } else {

       ExactChange(value, coins);

       if (coins[0] != 0) cout << coins[0] << " " << (coins[0] == 1 ? "dollar" : "dollars") << endl;

       if (coins[1] != 0) cout << coins[1] << " " << (coins[1] == 1 ? "quarter" : "quarters") << endl;

       if (coins[2] != 0) cout << coins[2] << " " << (coins[2] == 1 ? "dime" : "dimes") << endl;

       if (coins[3] != 0) cout << coins[3] << " " << (coins[3] == 1 ? "nickel" : "nickels") << endl;

       if (coins[4] != 0) cout << coins[4] << " " << (coins[4] == 1 ? "penny" : "pennies") << endl;

   }

   return 0;

}

You might be interested in
Discuss the impact of the changing urban center. Include the impacts on political, economic, and social roles and opportunities.
KengaRu [80]

Answer:

The 21st century world have been earmarked with great influx of people to the urban centre,the notion of gender equality and female education have also made most traditional roles in the family changing.Before now,wives we're known for their full independence on their husband who is considered the bread winner.

Inspite of the growth of of the urban centre the availability of resources have dwindled,resulting in the surge of unemployment in many urban centre,the political entity of the society which is the government have serious challenging in managing the various threat posed by overpopulation, unemployment results in the decrease of standard of living of person and family,to cater for this family have to change their roles,wives now work to support the husband.

Explanation:

6 0
3 years ago
The volume of microbial culture is observed to increase according to the formula
saw5 [17]

The expression of V(m³)=e^(t(s)) to make V in in³ and t in minutes is;

V(in³) = (¹/₆₁₀₂₄)ae^{\frac{1}{60}bt(h)

We are given that;

Volume of microbial culture is observed to increase according to the formula;

V = e^(t)

where;

t is in seconds

V is in m³

We want to now express V in in³ and t in minutes.

Now, from conversions;

1 m³ = 61024 in³

Also; 1 second = 1/60 minutes

according to formula for exponential decay, we know that;

V = ae^(bt)

Thus, we have;

61024V = ae^(¹/₆₀b(t(h))

V(in³) = (¹/₆₁₀₂₄)ae^{\frac{1}{60}bt(h)

Read more about subject of formula at; brainly.com/question/790938

3 0
2 years ago
Write the following decorators and apply them to a single function (applying multiple decorators to a single function): 1. The f
natita [175]

Answer:

Complete question is:

write the following decorators and apply them to a single function (applying multiple decorators to a single function):

1. The first decorator is called strong and has an inner function called wrapper. The purpose of this decorator is to add the html tags of <strong> and </strong> to the argument of the decorator. The return value of the wrapper should look like: return “<strong>” + func() + “</strong>”

2. The decorator will return the wrapper per usual.

3. The second decorator is called emphasis and has an inner function called wrapper. The purpose of this decorator is to add the html tags of <em> and </em> to the argument of the decorator similar to step 1. The return value of the wrapper should look like: return “<em>” + func() + “</em>.

4. Use the greetings() function in problem 1 as the decorated function that simply prints “Hello”.

5. Apply both decorators (by @ operator to greetings()).

6. Invoke the greetings() function and capture the result.

Code :

def strong_decorator(func):

def func_wrapper(name):

return "<strong>{0}</strong>".format(func(name))

return func_wrapper

def em_decorator(func):

def func_wrapper(name):

return "<em>{0}</em>".format(func(name))

return func_wrapper

@strong_decorator

@em_decorator

def Greetings(name):

return "{0}".format(name)

print(Greetings("Hello"))

Explanation:

5 0
3 years ago
Where’s the silicone rubber are made ? In a machine, vulcanization… explain please !!!!! I need help
Vaselesa [24]

Answer: This is done by heating a large volume of quartz sand to temperatures as high as 1800˚C. The result is pure, isolated silicon, which is allowed to cool and then ground into a fine powder. To make silicone, this fine silicon powder is combined with methyl chloride and heated once again.

Explanation:

4 0
3 years ago
Steam enters a turbine steadily at 7 MPa and 600°C with a velocity of 60 m/s and leaves at 25 kPa with a quality of 95 percent.
Rufina [12.5K]

Answer:

a) \dot m = 16.168\,\frac{kg}{s}, b) v_{out} = 680.590\,\frac{m}{s}, c) \dot W_{out} = 18276.307\,kW

Explanation:

A turbine is a steady-state devices which transforms fluid energy into mechanical energy and is modelled after the Principle of Mass Conservation and First Law of Thermodynamics, whose expressions are described hereafter:

Mass Balance

\frac{v_{in}\cdot A_{in}}{\nu_{in}} - \frac{v_{out}\cdot A_{out}}{\nu_{out}} = 0

Energy Balance

-q_{loss} - w_{out} + h_{in} - h_{out} = 0

Specific volumes and enthalpies are obtained from property tables for steam:

Inlet (Superheated Steam)

\nu_{in} = 0.055665\,\frac{m^{3}}{kg}

h_{in} = 3650.6\,\frac{kJ}{kg}

Outlet (Liquid-Vapor Mix)

\nu_{out} = 5.89328\,\frac{m^{3}}{kg}

h_{out} = 2500.2\,\frac{kJ}{kg}

a) The mass flow rate of the steam is:

\dot m = \frac{v_{in}\cdot A_{in}}{\nu_{in}}

\dot m = \frac{\left(60\,\frac{m}{s} \right)\cdot (0.015\,m^{2})}{0.055665\,\frac{m^{3}}{kg} }

\dot m = 16.168\,\frac{kg}{s}

b) The exit velocity of steam is:

\dot m = \frac{v_{out}\cdot A_{out}}{\nu_{out}}

v_{out} = \frac{\dot m \cdot \nu_{out}}{A_{out}}

v_{out} = \frac{\left(16.168\,\frac{kg}{s} \right)\cdot \left(5.89328\,\frac{m^{3}}{kg} \right)}{0.14\,m^{2}}

v_{out} = 680.590\,\frac{m}{s}

c) The power output of the steam turbine is:

\dot W_{out} = \dot m \cdot (-q_{loss} + h_{in}-h_{out})

\dot W_{out} = \left(16.168\,\frac{kg}{s} \right)\cdot \left(-20\,\frac{kJ}{kg} + 3650.6\,\frac{kJ}{kg} - 2500.2\,\frac{kJ}{kg}\right)

\dot W_{out} = 18276.307\,kW

6 0
3 years ago
Other questions:
  • 8. Explain how a duo-servo brake assembly works to provide great braking ability.
    11·1 answer
  • What is the relative % change in P if we double the absolute temperature of an ideal gas keeping mass and volume constant?
    14·1 answer
  • Name the main classes of polymer and define their characteristic properties
    15·1 answer
  • Diffrerentiate y=cos^{4} (3x+1)
    5·1 answer
  • The number of pulses per second from IGBTs is referred to as
    10·1 answer
  • Global Convection Patterns include which of the following?
    12·1 answer
  • What is the moment that the wrench puts on the bolt?
    13·1 answer
  • I want to know if anyone else know how to tell apart real leather from fake leather?!?!
    6·2 answers
  • A) If a given directional antenna can receive 15 times the power of an isotropic antenna, what is
    11·1 answer
  • It is acceptable to mix used absorbents.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!