Once upon a time there was a country called Plusplusland. The monetary system they used there was simple: the currency name was the "plussar" and their central bank issued five different banknotes of values 50, 20, 10, 5 and 1 plussar.Your task is to write a program for the ATMs of Plusplusland. The program should find the minimal number of banknotes needed to deliver any amount of money to the client.The Treasury Minister has asked you personally to do this. He expects your code to print the values of all the needed banknotes in a row – this is the format accepted by all ATMs in Plusplusland. Your program will require the use of an integer array combined with different loops to process the currency.Test your code using the sample data provided below......Example input125Example output50 50 20 5Example input127Example output50 50 20 5 1 1Example input49Example output20 20 5 1 1 1 1(HINT: Here is an array that maybe helpful for all known banknotes ordered from the most valuable to the leastint banknotes[] = {50, 20, 10, 5, 1} and then use your skill with array related processing combining different kinds of loops)

Answers

Answer 1
Answer:

Answer:

Hi!

The answer coded in Javascript is:

function minimalNumbersOfBanknotes(input) {

var banknotes = [50, 20, 10, 5, 1];

var output = '';

 //Each while writes on output variable the banknote and substract the same quantity on input variable.

 //If the input is lesser than the value of while banknote, step into next while.

  for (var i = 0; i < banknotes.length; i++) {

      while(input >= banknotes[i]) {

         output = output + '  ' + banknotes[i];

         input = input - banknotes[i];

     }

 }

 return output;

}


Related Questions

For additional security and to optimize the performance of critical machines on your organization’s network, it is crucial to:___________.
You are experiencing issues when trying to transfer files between two computers using FTP. What could be the potential cause(s) of the issue
3. Problem 5. A digital computer has a memory unit with 24 bits per word. The instruction set consists of 150 different operations. All instructions have an operation code part (opcode) and an address part (allowing for only one address). Each instruction is stored in one word of memory. a. How many bits are needed for the opcode? b. How many bits are left for the address part of the instruction? c. What is the maximum allowable size for memory? d. What is the largest unsigned binary number that can be accommodated in one word of memory?
Raj, a recent graduate, has recently joined your organization as a Junior Business Analyst. He has been asked to conduct a Feasibility Analysis on whether to automate the process of software installation or not. If you were in Raj's place, based on which of these parameters would you identify if that process can be automated? Pick onea. Availability of software licensingb. Entering license number during installationc. Operating System being usedd. Software version being used
A LAN Uses category 6 cabling. An issue with the connection results in network link to get degeneration and Only one device can communicate at a time. What is the connection operating at?Half duplexSimplexPartialFull Duplex

Which exercise can help you prevent Carpel Tunnel Syndrome?make a fist, hold, and stretch your fingers

bend slightly and stretch your right hand up

move your head back and forward slowly

blink your eyes often

Answers

Make a Fist, hold, and stretch your fingers is the correct answer
A. make a fist, hold, and stretch your fingers

C And D are rather absurd as Carpal Tunnel Syndrome is 
caused by a pinched nerve in the wrist.

Write a function named minMax() that accepts three integers arguments from the keyboard and finds the smallest and largest integers. Include the function minMax() in a working program. Make sure your function is called from main().Test the function by passing various combinations of three integers to it.

Answers

Answer:

public class Main

{

public static void main(String[] args) {

 minMax(1, 2, 3);

 minMax(100, 25, 33);

 minMax(11, 222, 37);

}

public static void minMax(int n1, int n2, int n3){

    int max, min;

    if(n1 >= n2 && n1 >= n3){

        max = n1;

    }

    else if(n2 >= n1 && n2 >= n3){

        max = n2;

    }

    else{

        max = n3;

    }

   

    if(n1 <= n2 && n1 <= n3){

        min = n1;

    }

    else if(n2 <= n1 && n2 <= n3){

        min = n2;

    }

    else{

        min = n3;

    }

    System.out.println("The max is " + max + "\nThe min is " + min);    

}

}

Explanation:

*The code is in Java.

Create a function named minMax() that takes three integers, n1, n2 and n3

Inside the function:

Declare the min and max

Check if n1 is greater than or equal to n2 and n3. If it is set it as max. If not, check if n2 is greater than or equal to n1 and n3. If it is set it as max. Otherwise, set n3 as max

Check if n1 is smaller than or equal to n2 and n3. If it is set it as min. If not, check if n2 is smaller than or equal to n1 and n3. If it is set it as min. Otherwise, set n3 as min

Print the max and min

Inside the main:

Call the minMax() with different combinations

If the following statement were in a C++ program, what would it do? cout >> "I love oranges and apples";

Answers

Answer:

It will show compilation error like - no match for 'operator>>'

Explanation:

<< and >> are input output stream operators which are used with different input output stream objects in C++. So << operator is used to output stream of characters to console or a file and >> operator is used to input or read some characters or integers from a file or console. Here input stream character is used with output stream object cout, which produces an error.  

Write a program that reads a list of words. Then, the program outputs those words and their frequencies. If the input is 5 hey hi Mark hi mark (the first number indicates the number of words that follow), the output is:hey 1
hi 2
Mark 1
hi 2
mark 1

Hint: Use two vectors, one for the strings, another for the frequencies.

Your program must define and use the following function: int GetFrequencyOfWord(vector wordsList, string currWord)

Answers

Answer:

/ declare the necessary header files.

#include <iostream>

#include <string>

#include <vector>

using namespace std;

// declare the main function.

int main()

{

// declare a vector.

vector<string> words;

vector<int> counts;

// declare variables.

int size;

string str;

cin >> size;

// start the for loop.

for(int i = 0; i < size; ++i)

{

// input string.

cin >> str;

words.push_back(str);

}

// start the for loop.

for(int i = 0; i < size; ++i)

{

int count = 0;

// start the for loop.

for(int j = 0; j < words.size(); ++j)

{

// check the condition.

if(words[j] == words[i])

{

count++;

}

}

counts.push_back(count);

}

// start the for loop.

for(int i = 0; i < size; ++i)

{

// display result on console.

cout << words[i] << "\t" << counts[i] << endl;

}

return 0;

}

Explanation:

What is the most important trait of the first pilot project in the AI Transformation Playbook?

Answers

Answer:

Succeed and show traction within 6-10 months.

Explanation:

Ai (Artificial Inteliigence), also known as machine intelligence, is a branch of computer science that is specialized in making smart machines that are capable of doing human tasks

AI Transformation Playbook is a guide to use AI in enterprises successfully, written by Co-founder of Google Brain, Andrew Ng. In his guide, he unveiled the steps that can be followed to successfully installing AI in enterprises, companies, etc.

The most important trait of the first pilot projects is that it succeeds and begins to show traction within 6-10 months.

In his guide, he summarised five steps to install AI in enterprises. The first step is to 'Execute pilot projects to gain  momentum.'

The most important trait of beginning with AI projects is that it succeeds first before being most valuable projects. The success is important as it will help to achieve familiarity and will help other people of the company to invest in this project more.

This success begins to show tractions within 6-12 months of its success.

The two ways to use the help menu is by searching of the contents or searching the _____ Menu
Index
File
Catalog

Answers

The two ways to use the help menu is by searching of the contents or searching the index.

Other Questions