Create an algorithm for program

Assignment Help Data Structure & Algorithms
Reference no: EM133247074

Assignment:

Create an algorithm for the following program: Vending Machine Change

Items distributed by a vending machine cost from 5 cents to $1.00 each, but the vending machine accepts only a single dollar bill for each item.

Determine how to distribute change using the fewest number of quarters, dimes, nickels, and pennies for an item.

Examples:

  • If the user purchases an item that costs 55 cents, your vending machine will return 45 cents change as follows: 1 quarter, 2 dimes, 0 nickels, and 0 pennies.
  • If the user purchases an item that costs 6 cents, then your vending machine will return 94 cents change: 3 quarters, 1 dime, 1 nickel, and 4 pennies.

Your algorithm should be able to make make change for every possible amount of change from 5 cents to 99 cents. Simply giving examples like the two above which describe specific instances is not an algorithm.

An algorithm that describes how to make change for each cost from 5 cents to 99 cents (using 90+ "if" statements) also is not acceptable.

Reference no: EM133247074

Questions Cloud

Explain business decision-makers : Price is the amount that consumers will be willing to pay for a product?
Discuss the use of digital data in human research : Discuss the five guideline areas suggested for managing privacy issues in regard to the use of digital data in human research.
Explain the threatening gestures : On March 15, 2021, at 2:30 a.m., Sandra Sue was in her home in West Palm Beach, Florida, when she heard loud voices and music. Ms. Doe looked out her living roo
What are the objective indicators by which legal ownership : What are the objective indicators by which legal ownership of land is established? Does subjective expectation, hope, belief, or claim mean anything? How does s
Create an algorithm for program : Your algorithm should be able to make make change for every possible amount of change from 5 cents to 99 cents.
Discuss process and steps would take : You are the CEO if a cancer treatment center. You have just discovered that your billing contractor has been inappropriately submitting separate claims to Medic
Discuss the concept of mutual mistake : Discuss the concept of Mutual mistake and what happens when the parties to the contract make a mutual mistake.
War memorial containing a vehicle : A District of Columbia ordinance prohibits "the use of any vehicle in any form in a District of Columbia park." Does the ordinance apply to the following?
Upper-management role in a company : You want to start your own business or will be taking an upper-management role in a company you currently work for. There are numerous legal-related considerati

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Explain the memory management algorithms

As memory management algorithms grow more complex, the CPU overhead increases and overall performance can suffer.

  Prepare a binary heap with a limited heap size

Prepare a binary heap with a limited heap size. In other words, the heap only keeps track of the n most important items.

  Discuss a hash code method in abstract collection

Additionally, provide a hash Code method in Abstract Collection that follows the general contract of hash Code.

  Pseudocode for divide-and-conquer algorithm

Write a pseudocode for a divide-and-conquer algorithm for finding the position of the largest element in an array of n numbers.

  Design greedy algorithm to solve activity selection problem

Design a greedy algorithm to solve the activity selection problem. Suppose there are a set of activities: a1, a2, ... an that wish to use a lecture hall. Each activity ai has a start time siand a finish time fi.

  Question about shortest prefixes

A prefix of a string is a substring string at the beginning of the given string. The prefixes of "carbon" are: c, ca, car, carb, carbo and carbon.

  Create a flowchart to show the process that will allow the

1.create a flowchart to show the process that will allow the implementation of stack push and pop operations.2.create a

  Find all pure-strategy nash equilibria

Consider the payoff matrix shown at right. Suppose agent 1 must move first, and agent 2 can see B agent 1's move before agent 2 chooses a move. Draw the game tree, find all pure-strategy Nash equilibria, C and tell which of them are subgame-perfec..

  Find two pairs of twin prime numbers

Let p and q be two prime numbers. If p = q + 2, then p and q are called twin prime numbers. Find two pairs of twin prime numbers.

  Randomized and Graph-Theoretic Method

Randomized and Graph-Theoretic Method - determine if there is a configuration of the switches so that all lightbulbs are simultaneously on

  Assignment - working with doubly linked lists

CS 20A: C++ Data Structures Assignment: Working with Doubly Linked Lists. In this assignment, you will implement the following four methods on an incomplete implementation of a doubly-linked list: append(const T& value): appends a node containing a s..

  Describe the base case of a recursive algorithm

Which of the following statements could describe the base case of a recursive algorithm? You are using a language that does not support recursion. What data structure would you use to traverse a binary search tree in order

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd