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
10. In CCS, Northing and Easting are
NeTakaya
C. Positive or negative depending on the zone
4 0
3 years ago
A circular bar is 800mm in length and 32mm in diameter. The bar is made from a material with a modulus of elasticity E = 150 GPa
Yuki888 [10]

Answer:

For any material if ∈ is the axial strain then the lateral strain is given by -μ∈ is the lateral strain in the object

Where,

μ is the poisson's ratio of the material

The longitudinal strain is calculated as follows

\varepsilon _{axial}=\frac{\Delta length}{Length_{original}}\\\\\therefore \varepsilon _{axial}=\frac{0.7}{800}=8.75\times 10^{-4}

Thus the lateral strain becomes

\varepsilon _{lateral}=-\mu\varepsilon _{axial}\\\\\varepsilon _{lateral}=-0.27\times 8.75\times 10^{-4}=-2.36\times 10^{-4}

now by definition of lateral strain we have

\varepsilon _{lateral}=\frac{\Delta diameter}{diameter_{original}}\\\\\Rightarrow \Delta Diameter=-2.36\times 10^{-4}\times 32=-7.56\times 10^{-3}\\\\D_{f}-D_{i}=-7.56\times 10^{-3}\\\\D_{f}=32-7.56\times 10^{-3}=31.992mm

By hookes law the stress developed due to the given strain is given by

\sigma =\varepsilon _{axial}E

Applying values we get

\sigma =8.75\times 10^{-4}\times 150\times 10^{9}\\\\\sigma =131.25MPa

Thus the force is calculated as

Force=\sigma \times Area\\\\Force=131.25\times 10^{6}\times \frac{\pi (32\times 10^{-3})^{4}}{4}\\\\Force=105.55kN

5 0
3 years ago
Degreasers can be broken down into two main categories
Alex17521 [72]
Degreasers can be categorized to be either water-based or solvent-based.
5 0
3 years ago
Read 2 more answers
Who wants me to make a device to resurrect Juice Wrld
Aleksandr-060686 [28]
Lolololollolollolollolololo
5 0
3 years ago
Consider a turbojet powered airplane flying at a standard altitude of 30,000ft at a velocity of 500 mph. The turbojet engine its
grandymaker [24]

Answer:

T  = 20.42 N

Explanation:

given data

standard altitude = 30,000 ft

velocity Ca = 500 mph = 0.4 m/s

inlet areas Aa = 7 ft² = 0.65 m²

exit areas Aj = 4.5 ft²  =  0.42 m²

velocity at exit Cj = 1600 ft/s = 487.68 m/s

pressure exit \rhoj = 640 lb/ft²   = 0.3 bar

solution

we get here thrust of the turbojet that is  express as

thrust of the turbojet T = Mg × Cj - Ma × Ca + ( \rhoj Aj - \rhoa Ag )   .............1

here Ma = Mg

Ma = \rhoa × Ca Aa = 0.042 kg/s

put value in equation 1 we get

T = 0.042 × (487.68 -0.14) + ( 0.3 ×  - 0.3 × 0.65 )  

T  = 20.42 N

5 0
3 years ago
Other questions:
  • Saturated steam coming off the turbine of a steam power plant at 30 °C condenses on the outside of a 3-cm-outer-diameter, 35-m-l
    15·1 answer
  • To become familiar with the general equations of plane strain used for determining in-plane principal strain, maximum in-plane s
    9·1 answer
  • What are the 3 stages of reverse engineering?
    14·1 answer
  • A turntable A is built into a stage for use in a theatrical production. It is observed during a rehearsal that a trunk B starts
    5·1 answer
  • List two reasons why machined parts often require a high degree of precision.
    8·1 answer
  • Differentiate between pulser switch and data switch
    8·1 answer
  • 4.
    10·1 answer
  • When an object is plumb, it is _____.
    11·2 answers
  • on the same scale for stress, the tensile true stress-true strain curve is higher than the engineeringstress-engineering strain
    10·1 answer
  • A tool used to put a concave edge on a plane iron is
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!