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 horizontal channel of height H has two fluids of different viscosities and densities flowing because of a pressure gradient dp
cricket20 [7]

Answer:

Given that;

Jello there, see explanstion for step by step solving.

A horizontal channel of height H has two fluids of different viscosities and densities flowing because of a pressure gradient dp/dx1. Find the velocity profiles of two fluids if the height of the flat interface is ha.

Explanation:

A horizontal channel of height H has two fluids of different viscosities and densities flowing because of a pressure gradient dp/dx1. Find the velocity profiles of two fluids if the height of the flat interface is ha.

See attachment for more clearity

6 0
3 years ago
The 1000-lb elevator is hoisted by the pulley system and motor M. The motor exerts a constant force of 500 lb on the cable. The
klemol [59]

The power that must be supplied to the motor is 136 hp

<u>Explanation:</u>

Given-

weight of the elevator, m = 1000 lb

Force on the table, F = 500 lb

Distance, s = 27 ft

Efficiency, ε = 0.65

Power  = ?

According to the equation of motion:

F = ma

3(500) - 1000 = \frac{1000}{32.2} * a

a = 16.1 ft/s²

We know,

v^2 - u^2 = 2a (S - So)\\\\v^2 - (0)^2 = 2 * 16.1 (27-0)\\\\v = 29.48m/s

To calculate the output power:

Pout = F. v

Pout = 3 (500) * 29.48

Pout = 44220 lb.ft/s

As efficiency is given and output power is known, we can calculate the input power.

ε = Pout / Pin

0.65 = 44220 / Pin

Pin = 68030.8 lb.ft/s

Pin = 68030.8 / 500 hp

     = 136 hp

Therefore, the power that must be supplied to the motor is 136 hp

5 0
3 years ago
How many hours should it take an articulated wheel loader equipped with a 4-yd^3 bucket to load 3000 yd^3 of gravel (average mat
densk [106]

Answer:

17 hours 15 minutes

Explanation:

See attached picture.

4 0
3 years ago
A 3-phase , 1MVA, 13.8kV/4160V, 60 Hz, transformer with Y-Delta winding connection is supplying a3-phase, 0.75 p.u. load on the
Tanya [424]

Answer:

a) 23.89 < -25.84 Ω

b) 31.38 < 25.84 A

c) 0.9323 leading

Explanation:

A) Calculate the load Impedance

current on load side = 0.75 p.u

power factor angle = 25.84

I_{load} = 0.75 < 25.84°

attached below is the remaining part of the solution

<u>B) Find the input current on the primary side in real units </u>

load current in primary = 31.38 < 25.84 A

<u>C) find the input power factor </u>

power factor = 0.9323 leading

<em></em>

<em>attached below is the detailed solution </em>

8 0
2 years ago
Why do I eat Takis please
sammy [17]

Answer:

because they taste good :)

7 0
10 months ago
Read 2 more answers
Other questions:
  • If a torque of M = 300 N⋅m is applied to the flywheel, determine the force that must be developed in the hydraulic cylinder CD t
    13·1 answer
  • An air-standard Otto cycle has a compression ratio of 6 and the temperature and pressure at the beginning of the compression pro
    13·1 answer
  • What is the maximum thermal efficiency possible for a power cycle operating between 600P'c and 110°C? a). 47% b). 56% c). 63% d)
    15·1 answer
  • In casting experiments performed using a certain alloy and type of sand mold, it took 170 sec for a cube-shaped casting to solid
    11·2 answers
  • In highways the far left lane is usually the _____
    11·2 answers
  • Which traditional subject is part of construction management or construction science syllabi?
    5·1 answer
  • A saturated 1.5 ft3 clay sample has a natural water content of 25%, shrinkage limit (SL) of 12% and a specific gravity (GS) of 2
    11·1 answer
  • Whats is the purpose of the stator winding​
    13·1 answer
  • alguien me ayuda con una tarea? Está en mi perfil de matemática, porfavorrr regalaré corona pero porfavor​
    7·1 answer
  • How many astronauts work<br> in the International Space Station
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!