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
What is the least count of screw gauge?<br> (a) 0.01 cm<br> (b) 0.001 cm<br> (c) 0.1 cm<br> (d) 1 mm
Nonamiya [84]
Its 0.001

0.01 x100 = 1mm
0.001x100=0.1mm
0.1=10mm
1m
3 0
2 years ago
A construction crew lifts approximately 400 lb. of material several times during a day from a flatbed truck to a 25 ft. rooftop.
Irina18 [472]

Answer:

2ib

Explanation:

if you divide 10 divided by 2 it gives you 5 and then subtract it by 2.2 = 2.8

there goes your answer.

5 0
1 year ago
What is the magnitude of the maximum stress that exists at the tip of an internal crack having a radius of curvature of 1.9 × 10
Fiesta28 [93]

Answer:

Recall the formula for the maximum stress, σₐ = 2σ₀ *√ (α/ρₓ)

where

σ₀ = tensile stress = 140 MPa = 1.40x 10⁸Pa

α = crack length = 3.8 × 10–2 mm = 3.8 x 10⁻⁵m

ρₓ = radius of curvature = 1.9 × 10⁻⁴mm = 1.9 × 10⁻⁷m

Substituting these values into the formula, we can calculate the max stress as

 ====== 2 x 1.40x 10⁸ x √(3.8 x 10⁻⁵/1.9 × 10⁻⁷)

σₐ  = 24.4MPa

6 0
3 years ago
Comparison of copper and aluminium conductors looking at their properties
Alexeev081 [22]

Answer:

The density of the copper is higher than aluminium. Hence it is heavier compared to aluminium conductors it requires strong structures and hardware to bear the weight. More ductile and has high tensile strength.

...

Aluminium & Copper properties.

Property Copper (Cu) Aluminium (Al)

Density (g/cm3) 8.96 2.70

7 0
3 years ago
A stress of 2500 psi is applied to a polymer serving as a fastener in a complex assembly. At a constant strain, the stress drops
sesenic [268]
Very very hard to answer
6 0
2 years ago
Other questions:
  • The first step to merging is entering the ramp and _____.
    10·1 answer
  • In very early human history, complex sanitation systems were not needed because settlements were usually very small, like the vi
    10·2 answers
  • 21. How long can food that requires time-temperature control be left in the danger zone?
    7·2 answers
  • What is electromagnetic induction?
    14·1 answer
  • In a diesel engine, the fuel is ignited by (a) spark (c) heat resulting from compressing air that is supplied for combustion (d)
    14·1 answer
  • A long rod of 60-mm diameter and thermophysical properties rho=8000 kg/m^3, c=500J/kgK, and k=50 W/mK is initally at a uniform t
    8·1 answer
  • In the planning process of the product development life cycle what is it important to inventory
    7·1 answer
  • Select the correct answer.
    6·1 answer
  • The coefficient of static friction for both wedge surfaces is μw=0.4 and that between the 27-kg concrete block and the β=20° inc
    6·1 answer
  • From the list of problems below, check all that are known to be NP-complete. You do not need to justify your answer. (Set cover)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!