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 sprue is 12 in long and has a diameter of 5 in at the top. The molten metal level in the pouring basing is taken to be 3 in fr
vampirchik [111]

Answer:

See explaination

Explanation:

We can describe Aspiration Effect as a phenomenon of providing an allowance for the release of air from the mold cavity during the metal pouring.

See the attached file for detailed solution of the given problem.

8 0
3 years ago
Read 2 more answers
Working with which of these systems requires a technician that has been certified in an EPA-approved course?
makvit [3.9K]

EPA Regulations provides a certified course for the technicians involved in the Air-conditioning system.

Answer: Option (b)

<u>Explanation:</u>

The EPA regulation has implemented an act called the "Clean Air Act" under the "section of 609".

This act provides some basic requirements for EPA Regulation such as follows;

  • Refrigerant: This unit must be approved by EPA Regulations before being implemented into the atmosphere.
  • Servicing: This system provides a certified course for technicians in service and also approve them with proper refrigerant equipment.
  • Reuse Refrigerants: The use of recycled refrigerants must be properly monitored before it comes in to serve.
6 0
4 years ago
What are some advantages of generating electrical energy from tides instead of from fossil fuels
harina [27]

Answer:

Efficent at low speeds.

Explanation:

Since water is 1,000 times more dense than air, electricity can generated from tides much more efficiently at slower speeds than wind turbines can.

7 0
3 years ago
In a short essay, discuss the question, "How are you an innovator?"
iragen [17]

Answer:

Being innovative means doing things differently or doing things that have never been done before. An innovator is someone who has embraced this idea and creates environments in which employees are given the tools and resources to challenge the status quo, push boundaries and achieve growth.

Explanation:

Hope it helps..

But it's a little bit long..

Correct me if I'm wrong..

7 0
3 years ago
A machine used to lift motorcycles consists of an electric winch pulling on one supporting cable of a block and tackle system. T
Kobotan [32]

Answer: So you are dealing with maximum and minimum weights and you want to know what MINIMUM number of supporting strands for this block and tackle system are needed I believe. If so you are dealing with economic imbalances Though we are not worrying about money Right? Right we need physics which Physics study matter and how it moves You would need 8 STRANDS

Explanation: Step By Step

5 0
3 years ago
Other questions:
  • How are eras different from decades?
    5·1 answer
  • What is the major drawback to use whiskers as a dispersed agents in composites? a)- High price b)- Large length to diameter rati
    7·1 answer
  • If these components have weights WA = 50000 lb , WB=8000lb, and WC=6000lb, determine the normal reactions of the wheels D, E, an
    14·1 answer
  • You are a technical writer for Landson Toy Company. Landson has just designed a new, more durable swing set for 6- to 10-year-ol
    9·1 answer
  • Airplanes typically have a Pitot-static probe located on the underside that measures relative wind speed as the airplane flies.
    6·1 answer
  • Calculate the number of vacancies per cubic meter for some metal, M, at 749°C. The energy for vacancy formation is 0.86 eV/atom,
    5·1 answer
  • Applications of fleming hand rule
    6·1 answer
  • ⚠️I mark BRIANLIST ⚠️The same engineering teams are able to design and develop the different subsystems for an airplane.
    5·2 answers
  • What is a chipping hammer used for? <br><br> State three things.
    7·2 answers
  • Ferroconcrete is reinforced concrete that combines concrete and ________. A. Lead c. Copper b. Iron d. Aluminum.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!