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
A total of 245 kip force is applied to a set of 10 similar bolts. If the spring constant of each bolt is 0.4 Mlb/in and that of
zubka84 [21]

Answer: The net force in every bolt is 44.9 kip

Explanation:

Given that;

External load applied = 245 kip

number of bolts n = 10

External Load shared by each bolt (P_E) = 245/10 = 24.5 kip

spring constant of the bolt Kb = 0.4 Mlb/in

spring constant of members Kc = 1.6 Mlb/in

combined stiffness factor C = Kb / (kb+kc) = 0.4 / ( 0.4 + 1.6)  = 0.4 / 2 = 0.2 Mlb/in

Initial pre load Pi = 40 kip

now for Bolts; both pre load Pi and external load P_E are tensile in nature, therefore we add both of them

External Load on each bolt P_Eb = C × PE = 0.2 × 24.5 = 4.9 kip

So Total net Force on each bolt Fb = P_Eb + Pi

Fb = 4.9 kip + 40 kip

Fb = 44.9 kip

Therefore the net force in every bolt is 44.9 kip

4 0
3 years ago
Which investigative process is most helpful for learning about past societies?
tatuchka [14]

Answer: think it A

Explanation: makes

6 0
3 years ago
A ball thrown vertically upward from the top of a building of 60ft with an initial velocity of vA=35 ft/s. Determine (a) how hig
Masteriza [31]

Answer:

A.) 62.5 ft

B.) 3.58 seconds

C.) 8.58 seconds

Explanation:

A.) Given that a ball is thrown vertically upward from the top of a building of 60ft with an initial velocity of vA=35 ft/s

To determine how high above the top of the building the ball will go before it stops at B, let us use the third equation of motion.

V^2 = U^2 - 2gH

Since the ball is going up, g will be negative. And at maximum height, V = 0

Substitute all the parameters into the formula

0 = 35^2 - 2 × 9.8 × H

19.6H = 1225

H = 1225/19.6

H = 62.5 ft

(B) The time tAB it takes to reach its maximum height will be achieved by using second equation of motion

H = Ut - 1/2gt^2

Substitutes all the parameters into the formula

62.5 = 35t - 1/2 × 9.8 × t^2

62.5 = 35t - 4.9t^2

4.9t^2 - 35t + 62.5 = 0

Let's use quadratic equations to find t

Divide all by 4.9

t^2 - 7.143t + 12.755 = 0

t^2 - 7.143t + 3.57^2 = - 12.755 + 3.57^2

( t - 3.57)^2 = 0.000102

( t - 3.57 ) = +/-( 0.01 )

t = 3.57 + 0.01

t = 3.58 seconds

Ignore the negative one.

(C) the total time tAC needed for it to reach the ground at C from the instant it is released.

When the object is falling back from B, the initial velocity = 0. And the height h will be 60 + 62.5 = 122.5 ft

Using equation 2 of equations of motion again.

h = 1/2gt^2

122.5 = 1/2 × 9.8 × t^2

122.5 = 4.9t^2

t^2 = 122.5/4.9

t^2 = 25

t = 5

Total time = 5 + 3.58 = 8.58 seconds

3 0
3 years ago
Explain why the following scenario fails to meet the definition of a project description.
s344n2d4d5 [400]

Answer:

The youth hockey training facility

Explanation:

7 0
3 years ago
Fast plz-The mirror check may involve ______________.
barxatty [35]

Answer:

Realigning the mirror

Explanation:

mirrors should be aligned to minimize blind spots, not look at the tires.

6 0
3 years ago
Other questions:
  • A 3-kg block rests on top of a 2-kg block supported by, but not attached to, a spring of constant 40 N/m. The upper block is sud
    14·2 answers
  • What parts does the block contain?
    5·2 answers
  • Global Courier Services will ship your package based on how much it weighs and how far you are sending the package. Packages abo
    14·1 answer
  • A non-linear analog force sensor outputs the following voltages for different forces.
    7·1 answer
  • In casting experiments performed using a certain alloy and type of sand mold, it took 155 sec for a cube-shaped casting to solid
    9·1 answer
  • A minor road intersects a major 4-lane divided road with a design speed of 50 mph and a median width of 12 ft. The intersection
    13·1 answer
  • Ordan has _ 5 8 can of green paint and _ 3 6 can of blue paint. If the cans are the same size, does Jordan have more green paint
    15·1 answer
  • How to comment on brainly.com and I'm only 8-years-old so keep it simple please
    9·1 answer
  • Why is there an Engineering Process?
    15·2 answers
  • A ____ is either in the pressure reducer or in the downstream side of the system to ensure that the control air pressure does no
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!