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
son4ous [18]
3 years ago
14

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)
Computers and Technology
1 answer:
Rainbow [258]3 years ago
3 0

Answer:

Hi!

The answer coded in Javascript is:

function minimalNumbersOfBanknotes(input) {

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

var output = '';

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

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

<em />

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

      while(input >= banknotes[i]) {

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

         input = input - banknotes[i];

     }

 }

 return output;

}

You might be interested in
Three reasons why users attach speakers to their computers.
ZanzabumX [31]

Answer:

Iv'e answered this question 2 times already lol. The purpose of speakers is to produce audio output that can be heard by the listener. Speakers are transducers that convert electromagnetic waves into sound waves. The speakers receive audio input from a device such as a computer or an audio receiver.

Explanation: I hope this helps!

8 0
3 years ago
Polygon transform (25 points). Write a library of static methods that performs various geometric transforms on polygons. Mathema
kari74 [83]

Answer:

import java.lang.*;               //for using Math.cos() and Math.sin() and Math.toRadians() funcitons in rotate method

public class PolygonTransform

{

  public static double[] copy(double[] array)

  {

      double[] newArray = new double[array.length];

      for(int i=0;i<array.length;i++)

      {

          newArray[i] = array[i];

          return newArray;

      }

  }

  public static void scale(double[]x,double[]y,double alpha)

  {

      for(int i=0;i<x.length;i++)

      {

          x[i] *= alpha;

          y[i] *= alpha;

      }

  }

  public static void translate(double[]x,double[]y,double dx,double dy)

  {

      for(int i=0;i<x.length;i++)

      {

          x[i] += dx;

          y[i] += dy;

      }

  }

  public static void rotate(double[] x, double[]y,double theta)

  {

      double rad = Math.toRadians(theta);

      double temp;

      for(int i=0;i<x.length;i++)

      {

          temp = x[i];                           //For storing temporarily the previous value of x before changing so tha it can be used in changing y

          x[i] = x[i]*Math.cos(rad) - y[i]*Math.sin(rad);

          y[i] = y[i]*Math.cos(rad) + temp*Math.sin(rad);  

      }

  }

  public static void main(String args[])

  {

      //This is just implementing you testcase discripted.

      double[]x = new double[4];

      double[]y = new double[4];

      StdDraw.setScale(-5.0, +5.0);

      x = { 0, 1, 1, 0 };

      y = { 0, 0, 2, 1 };

      double alpha = 2.0;

      StdDraw.setPenColor(StdDraw.RED);

      StdDraw.polygon(x, y);

      scale(x, y, alpha);

      StdDraw.setPenColor(StdDraw.BLUE);

      StdDraw.polygon(x, y);

      // Translates polygon by (2, 1).

      StdDraw.setScale(-5.0, +5.0);

      x = { 0, 1, 1, 0 };

      y = { 0, 0, 2, 1 };

      double dx = 2.0, dy = 1.0;

      StdDraw.setPenColor(StdDraw.RED);

      StdDraw.polygon(x, y);

      translate(x, y, dx, dy);

      StdDraw.setPenColor(StdDraw.BLUE);

      StdDraw.polygon(x, y);

      // Rotates polygon 45 degrees.

      StdDraw.setScale(-5.0, +5.0);

      x = { 0, 1, 1, 0 };

      y = { 0, 0, 2, 1 };

      double theta = 45.0;

      StdDraw.setPenColor(StdDraw.RED);

      StdDraw.polygon(x, y);

      rotate(x, y, theta);

      StdDraw.setPenColor(StdDraw.BLUE);

      StdDraw.polygon(x, y);

  }

}

Explanation:

6 0
3 years ago
Which of the following describes the operating system
Marianna [84]

Answer:

Explanation:

you added no options

5 0
3 years ago
A company is in the middle of an operating system update to Windows 10 from Windows XP, Windows 7, and Windows 8.x. The diverse
Masja [62]

Answer:

a. Insufficient number of physical processor cores.

Explanation:

Based on the information provided within the question it can be said that the most likely cause of this would be that there is an Insufficient number of physical processor cores . Therefore the few cores are having to deal with all of the information that needs to be processed, which they cannot handle. More cores would allow the information to be spread between them and the CPU load to be lowered.

8 0
3 years ago
Each column in an access table datasheet represents a ____.
kakasveta [241]
....field while a row represents a record
4 0
3 years ago
Other questions:
  • A password checking system that disallows user passwords that are proper names or words that are normally included in a dictiona
    15·1 answer
  • Part 2: students and courses, part 1  java review you may use an ide or a text editor, but i will test this by compiling and ru
    6·1 answer
  • Which technology can allow a single ground-based telescope to achieve images as sharp as those from the Hubble Space Telescope?
    7·1 answer
  • What the repeal of online privacy protections means for you?
    8·1 answer
  • Self-disclosure is most likely to occur _____________.a.
    7·2 answers
  • Virtual classrooms are examples of communication or not​
    5·2 answers
  • 1, How can technology serve to promote or restrict human rights? [2 points]
    5·1 answer
  • Now the y0utube home screen is gone
    13·2 answers
  • (25 POINTS) Some applications work on all devices while others work on some devices. True or False?
    13·1 answer
  • How to write my name in binary code ? Rivas
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!