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
kykrilka [37]
3 years ago
12

Write a program to assist a cashier with determining correct change. The program should have one input, the number of cents to r

eturn to the customer. The output should be the appropriate change in quarters, dimes, nickels and cents.
Computers and Technology
1 answer:
SCORPION-xisa [38]3 years ago
5 0
```
#!/usr/local/bin/python3

import sys

coins = { "quarters" : 25, "dimes" : 10, "nickels" : 5, "pennies" : 1 }

def mkChange( balance, coin ):
    qty = balance // coins[ coin ]
    if( qty ):
        print( str( qty ) + ' ' + coin )
    return( balance % coins[ coin ] )

if( __name__ == "__main__" ):
    if( len( sys.argv ) == 2 ):
        balance = int( sys.argv[ 1 ] )
        balance = mkChange( balance, "quarters" )
        balance = mkChange( balance, "dimes" )
        balance = mkChange( balance, "nickels" )
        balance = mkChange( balance, "pennies" )
    else:
        sys.stderr.write( "\nusage: " + sys.argv[ 0 ] + " <change owed>\n" )
```


You might be interested in
Write pseudo code that performs the following: Ask a user to enter a number. If the
CaHeK987 [17]
Answer:
BEGIN
INPUT N
IF N>0 AND N<10 THEN
OUTPUT "blue"
ELSE
IF N>10 AND N<20 THEN
OUTPUT "red"
ELSE
IF N>20 AND N<30 THEN
OUTPUT "green"
ELSE
OUTPUT "It is not a correct color option"
ENDIF
END.

Explanation:

3 0
2 years ago
Objects of the calculator class require no additional information when created. define an object named calc, of type calculator.
Grace [21]

Answer

calculator calc;

Explanation

An object is an instance of a class. And a class is what defines or describes the behavior or the state of the object of its type. When a class is defined no memory is allocated until when an object is created memory is allocated.

4 0
3 years ago
Read 2 more answers
The Operating System provides utility software designed to perform specific tasks. What task(s) does it perform? Select all that
viktelen [127]

Answer:

All of the above.

Explanation:

An operating system is a system software pre-installed on a computing device to manage or control software application, computer hardware and user processes.

This ultimately implies that, an operating system acts as an interface or intermediary between the computer end user and the hardware portion of the computer system (computer hardware) in the processing and execution of instructions.

Some examples of an operating system on computers are QNX, Linux, OpenVMS, MacOS, Microsoft windows, IBM, Solaris, VM etc.

Hence, the operating system (OS) provides utility software designed to perform specific tasks. Some of the tasks it performs are;

A. Establishing an Internet connection.

B. Coordinating tasks between programs.

C. Configuring peripheral devices.

D. Monitoring security.

7 0
2 years ago
Let's say you wanted to make an American Football game. What is an example of a legal issue you'd have to watch out for?
IgorC [24]

Answer:

Personal injury.

Explanation:

With a bunch of people running around on a field with a goal of <em>slamming into each other</em>, bodily injury becomes a relevant liability.

7 0
1 year ago
Consider the following definition of a recursive method. public static int mystery(int[] list, int first, int last) { if (first
ozzi

Answer:

c. 27

Explanation:

  • In recursion method, a method calls itself until a condition becomes true and returned back. In mystery(), at first time, first is 0 and last is 4. Condition is checked and 0!=4 so else part is executed in which again mystery is called with first as 1 and last 4. This will go again and again until first=4.
  • When first=4 it is also equal to last so if part is executed and alpha[4] is returned which is 9, now it comes alpha[3] +9 which is 8+9 =17 .
  • It is returning values to its previous calls that is why it will reduce to alpha[0]+alpha[1]+alpha[2]+17 which is nothing but sum of all elements of a alpha
  • Then, 1+4+5+8+9=27.
5 0
3 years ago
Other questions:
  • Insert the components that the computer uses to perform the tasks of each of the parts:
    13·1 answer
  • What property of semi-metals is useful in the computer industry?
    7·1 answer
  • How can you crop a photo in PowerPoint?
    15·2 answers
  • What is ur Favorite anime
    8·1 answer
  • What is an example of a hard skill?
    12·2 answers
  • C program To print odd numbers from 15 to 1 ​
    8·1 answer
  • Give me at least five main characteristic of irrigation equipment​
    8·1 answer
  • ¿En qué países se ha implementado un sistema de vigilancia a través de drones?, ¿qué aspectos positivos y negativos ha generado?
    13·1 answer
  • Explain how a stored procedure is processed by the DBMS query processor (including the type of return value after the query is p
    15·1 answer
  • What were the names of Henry VIII's six wives?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!