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
To 3 significant digits, what is the temperature of water in degrees C, if its pressure is 350 kPa and the quality is 0.01
liq [111]

Answer:

138.9 °C

Explanation:

The datum of quality is saying to us that liquid water is in equilibrium with steam. Saturated water table gives information about this liquid-vapour equilibrium. In figure attached, it can be seen that at 350 kPa of pressure (or 3.5 bar) equilibrium temperature is 138.9 °C

3 0
3 years ago
¿Cuándo se formarán cristales en una mezcla que se está evaporando?
Georgia [21]
Answer - La cristalización ye un procesu químicu pol cual a partir d'un gas, un líquidu o una disolución, los iones, átomos o molécules establecen enllaces hasta formar una rede cristalina, la unidá básica d'un cristal. La cristalización emplegar con bastante frecuencia en química para purificar una sustancia sólida.
5 0
3 years ago
An air-conditioning system operating on the reversed Carnot cycle is required to transfer heat from a house at a rate of 755 kJ/
Lyrx [107]

Answer:

There is 0.466 KW required to operate this air-conditioning system

Explanation:

<u>Step 1:</u> Data given

Heat transfer rate of the house = Ql = 755 kJ/min

House temperature = Th = 24°C = 24 +273 = 297 Kelvin

Outdoor temperature = To = 35 °C = 35 + 273 = 308 Kelvin

<u>Step 2: </u> Calculate the coefficient of performance o reversed carnot air-conditioner working between the specified temperature limits.

COPr,c = 1 / ((To/Th) - 1)

COPr,c = 1 /(( 308/297) - 1)

COPr,c = 1/ 0.037

COPr,c = 27

<u>Step 3:</u> The power input cna be given as followed:

Wnet,in = Ql / COPr,max

Wnet, in = 755  / 27

Wnet,in = 27.963 kJ/min

Win = 27.963 * 1 KW/60kJ/min  = 0.466 KW

There is 0.466 KW required to operate this air-conditioning system

3 0
3 years ago
6. During some actual expansion and compression processes in piston–cylinder devices, the gases have been
Katyanochek1 [597]

During some actual expansion and compression processes in piston-cylinder devices, the gases have been are the P1= P2.

<h3>What is the pressure?</h3>

Pressure is something that has the pressure that is physical and that causes the pressure is piston-cylinder devices.

During a few real enlargements and compression procedures in piston-cylinder devices, the gases were located to meet the connection PV n = C, wherein n and C are constants.

Read more about the pressure :

brainly.com/question/25736513

#SPJ1

5 0
2 years ago
Find the mechanical average of a wheel axle System of the wheel has a radius of 1.5 feet in the accident has a radius of 6 inche
kvasek [131]

Answer:

Mechanical average of a wheel = 3

Explanation:

Given:

Radius of wheel = 1.5 ft = 1.5 x 12 = 18 inches

Radius of axle = 6 inches

Find:

Mechanical average of a wheel

Computation:

Mechanical average of a wheel = Radius of wheel / Radius of axle

Mechanical average of a wheel = 18 / 6

Mechanical average of a wheel = 3

4 0
3 years ago
Other questions:
  • Please read
    6·1 answer
  • A 2-cm-diameter vertical water jet is injected upward by a nozzle at a speed of 15 m/s. Determine the maximum weight of a flat p
    10·1 answer
  • It is not a practical proposition to take direct measurements in nanoscale, but we can estimate variations in position and momen
    15·1 answer
  • Two hemispherical shells of inner diameter 1m are joined together with 12 equally spaced bolts. If the interior pressure is rais
    15·1 answer
  • What steps might one take to make a decision or solve a problem
    10·2 answers
  • Explain why change is inevitable in complex systems and give examples (apart from prototyping and incremental delivery) of softw
    6·1 answer
  • What should you do before you start welding?
    9·1 answer
  • Cryogenic liquid storage. Liquid oxygen is stored in a thin-walled spherical container, 96 cm in diameter, which is further encl
    10·1 answer
  • Think of an employee object. What are several of the possible states that the object may have over time?
    6·1 answer
  • A steel rod, which is free to move, has a length of 200 mm and a diameter of 20 mm at a temperature of 15oC. If the rod is heate
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!