Write a program that simulates the functionality

Assignment Help Programming Languages
Reference no: EM132211486

Question: Write a program that simulates the functionality of a vending machine having the following characteristics:

The vending machine offers 5 products

The vending machine accepts coins, 1 dollar bills, and 5 dollar bills

The change is always given in coins, with maximum possible number of coins in each value: 25, 10, 5 or 1 cent.

The selections available for user are numbers from 1 to 5.

The user enters the money - simulate the action through a loop that ends when the user enters 0. Each coin, or paper bill will be read individually.

The user makes the selection, and the machine allows a maximum 4 other selections if the amount entered doesn't cover the price of the item.

Once an item is delivered, the machine gives the change in coins.

There is no increment for the money during one selection.

The user can stop the selection at any time by entering 0 for the product selection.

If the user chooses to cancel the selection, the machine returns the initial amount in coins.

Display the outcome of the operation for each alternative you consider possible for the vending machine.

Make sure that the machine returns the correct change at all times.

Use appropriate selection and repetition loops to solve the problem.

Write a test program that would take at least 3 combinations of amounts entered and choices of products, and displays the results of all three trials. You can include the vending machine program as a method in the testing program.

Reference no: EM132211486

Questions Cloud

Allow the user to enter data for up to twenty students : The program should sort the array elements in ascending order by the student's last name and first name.
Write a program for the gcd and lcm : Write a program that shows that the product of two positive integers is equal to the product of their GCD (Greatest Common Divisor) and LCM.
Write a program that reverses a text file : Write a program that reverses a text file by using a stack. The user interface must consist of 2 list boxes and 3 buttons. The 3 buttons are.
Write a program that will take a sentence : Write a program that will take a sentence (a single String) such as "the lazy dog tripped over the bar stool", picks out the individual words (substrings).
Write a program that simulates the functionality : Write a program that simulates the functionality of a vending machine having the following characteristics: The vending machine offers 5 products.
Create an array to hold average house price : Create an array to hold average house price for the each of past 25 years for a single family residence of 1500 square feet. Initialize the array.
Create a trigger : CP5503 - Enterprise Database Systems - Oracle - write an anonymous block (PL/SQLstatements) to call the function to test
Write the program to show how depth-first search works : Write the program to show how depth-first search works on the following graph. Assume that the DFS procedure considers the vertices in alphabetical order.
WAP that takes integer as number of both rows and columns : Write a program ShiftNumbers.java that takes integer M as the number of both rows and columns for your 2D array. Create the same exact following 2D array.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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