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
The distribution of actual weights of 8‑ounce wedges of cheddar cheese produced at a dairy is Normal, with mean 8.1 ounces and s
s344n2d4d5 [400]

Answer:

sampling distribution

Explanation:

Sampling distribution is distribution of multiple samples' satistics of a population.

3 0
3 years ago
You are driving on a road where the speed limit is 35 mph. If you want to make a turn, you must start to signal at least _______
stich3 [128]
I believe it’s D) 20 feet
3 0
3 years ago
When passing another vehicle, when is it acceptable to drive over the
miss Akunina [59]

Answer:

Under no circumstances

Explanation:

I'm not 100% sure why, but I remember hearing that you're not suposed to go over the speed limit no matter what

7 0
3 years ago
Read 2 more answers
Write short notes on: (any four) a) Suspended ground floor b) Soil exploration c) Baulking of sand d) Bearing capacity of soil e
vredina [299]

Answer:

a) A suspended floor is a ground floor with a void underneath the structure. The floor can be formed in various ways, using timber joists, precast concrete panels, block and beam system or cast in-situ with reinforced concrete. However, the floor structure is supported by external and internal walls.

b) Soil exploration consists of determining the profile of the natural soil deposits at the site, taking the soil samples and determining the engineering properties of soils using laboratory tests as well as in-situ testing methods

c) Bulking in sand Occurs When dry sand interacts with the atmospheric moisture. Presence of moisture content forms a thin layer around sand particles. This layer generates the force which makes particles to move aside to each other. This results in the increase of the volume of sand.

d) In a nutshell, bearing capacity is the capacity of soil to support the loads that are applied to the ground above. It depends primarily on the type of soil, its shear strength and its density. It also depends on the depth of embedment of the load – the deeper it is founded, the greater the bearing capacity.

Explanation:

<h2>please follow me</h2>
6 0
3 years ago
A frying pan is connected to a 150-volt circuit. If the resistance of the frying pan is 25 ohms, how many amperes does the fryin
mario62 [17]

Answer:

Explanation:

Ohms Law I=E/R (resistive requires no power factor correction)

150/25= 6 amps

5 0
3 years ago
Other questions:
  • Someone claims that the shear stress at the center of a circular pipe during fully developed laminar flow is zero. Do you agree
    12·1 answer
  • Define ""acidity"" of an aqueous solution. How do you compare the strength of acidity of solutions ?
    6·1 answer
  • One of the disadvantages of the test of the hypothesis is that the final decision cannot be said to be completely correct eviden
    13·1 answer
  • An organization is struggling to differentiate threats from normal traffic and access to systems. A security engineer has been a
    12·1 answer
  • Why is a crank-rocker mechanism more useful than a double-rocker mechanism?
    13·1 answer
  • Estimate the uncertainty in a 22 m/sec air velocity measurement using a Pitot tube at 20C. Assume the atmospheric pressure is 1
    7·1 answer
  • ?Why the efficiency of Class A amplifier is very poor​
    11·1 answer
  • Who was the American founder and leader of the Shakers in the 1770’s who advocated equality, individual responsibility, and peac
    11·2 answers
  • Andy is a carpenter and wants to make various articles using engineered wood. Which of these wood types can he use?
    8·2 answers
  • Which of the following is described as a way engineers can test and investigate how things should be under certain circumstances
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!