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
Water flows through a pipe of 100 mm at the rate of 0.9 m3 per minute at section A. It tapers to 50mm diameter at B, A being 1.5
pochemuha

Answer:

The velocities in points A and B are 1.9 and 7.63 m/s respectively. The Pressure at point B is 28 Kpa.

Explanation:

Assuming the fluid to be incompressible we can apply for the continuity equation for fluids:

Aa.Va=Ab.Vb=Q

Where A, V and Q are the areas, velocities and volume rate respectively. For section A and B the areas are:

Aa=\frac{pi.Da^2}{4}= \frac{\pi.(0.1m)^2}{4}=7.85*10^{-3}\ m^3

Ab=\frac{pi.Db^2}{4}= \frac{\pi.(0.05m)^2}{4}=1.95*10^{-3}\ m^3

Using the volume rate:

Va=\frac{Q}{Aa}=\frac{0.9m^3}{7.85*10^{-3}\ m^3} = 1.9\ m/s

Vb = \frac{Q}{Ab}= \frac{0.9m^3}{1.96*10^{-3}\ m^3} = 7.63\ m/s

Assuming no losses, the energy equation for fluids can be written as:

Pa+\frac{1}{2}pa.Va^2+pa.g.za=Pb+\frac{1}{2}pb.Vb^2+pb.g.zb

Here P, V, p, z and g represent the pressure, velocities, height and gravity acceleration. Considering the zero height level at point A and solving for Pb:

Pb=Pa+\frac{1}{2}pa(Va^2-Vb^2)-pa.g.za

Knowing the manometric pressure in point A of 70kPa, the height at point B of 1.5 meters, the density of water of 1000 kg/m^3 and the velocities calculated, the pressure at B results:

Pb = 70000Pa+ \frac{1}{2}*1000\ \frac{kg}{m^3}*((1.9m/s)^2 - (7.63m/s)^2) - 1000\frac{kg}{m^3}*9,81\frac{m}{s^2}*1.5m

Pb = 70000\ Pa-27303\ Pa - 14715\ Pa

Pb = 27,996\ Pa = 28\ kPa

6 0
3 years ago
3. An inductor is connected to a 60 Hz circuit. The inductive reactance is 75.42. What is the inductance of the
Digiron [165]

Answer:

Many circuits also contain capacitors and inductors, in addition to resistors and ... (a) Calculate the inductive reactance of a 3.00 mH inductor when 60.0 Hz and ... Part a of the figure shows a capacitor C connected across an A C voltage source V .... 5: (a) Find the current through a 0.500 H inductor connected to a 60.0 Hz, ...

Explanation:

hope this helps

8 0
3 years ago
Water at 60°F passes through 0.75-in-internal diameter copper tubes at a rate of 1.2 lbm/s. Determine the pumping power per ft
Lelu [443]

Answer:

The pumping power per ft of pipe length required to maintain this flow at the specified rate 0.370 Watts

Explanation:

See calculation attached.

- First obtain the properties of water at 60⁰F. Density of water, dynamic viscosity, roughness value of copper tubing.

- Calculate the cross-sectional flow area.

- Calculate the average velocity of water in the copper tubes.

- Calculate the frictional factor for the copper tubing for turbulent flow using Colebrook equation.

- Calculate the pressure drop in the copper tubes.

- Then finally calculate the power required for pumping.

8 0
3 years ago
Plz help electrical technology
oksano4ka [1.4K]

Answer:

OPTION A,Larger

HOPE IT HELPS

8 0
3 years ago
Read 2 more answers
The environmental Protection Agency (EPA) has two programs that make a business an energy star. They are the following:
valkas [14]

The environmental Protection Agency (EPA) has two programs that make a business an energy star which are Energy Star program and WaterSense.

<h3>What is environmental Protection Agency (EPA)?</h3>

This is an agency in the United States, designed to enforce regulations that protect the environment and natural resources.

The Agency does the following :

  1. Protects people and the environment from significant health risks.
  2. Sponsors and conducts research.
  3. Develop ideas towards protecting the environment.

Hence, the environmental Protection Agency (EPA) has two programs that make a business an energy star which are Energy Star program and WaterSense.

Learn more about environmental Protection Agency (EPA) here :  brainly.com/question/20299710

#SPJ1

7 0
3 years ago
Other questions:
  • Which statement about tensile stress is true? A. Forces that act perpendicular to the surface and pull an object apart exert a t
    9·1 answer
  • 10. The repair order is a legal document because
    7·1 answer
  • 3- A cylinder with 0.4kg of Nitrogen gas at 27ºC keeps under pressure by a frictionless piston. Weight of this piston will incre
    6·1 answer
  • Your manager has asked you to research and recommend a writing guide that examiners in your digital forensics company can use fo
    8·1 answer
  • (a) Consider a germanium semiconductor at T 300 K. Calculate the thermal equilibrium electron and hole concentrations for (i) Nd
    7·1 answer
  • Explain the process of fractional distillation (include cracking)
    11·1 answer
  • In a ground-water basin of 12 square miles, there are two aquifers: an upper unconfined aquifer 500 ft in thickness and a lower
    12·1 answer
  • After adjusting your seat, your___ should be as closest possible to the back rest.
    14·1 answer
  • At what times should you use your headlights?
    12·2 answers
  • What is mechanical engineering about
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!