Write a program that will simulate this vending machine

Assignment Help JAVA Programming
Reference no: EM132107335

Program Using C.

A vending machine sells three kinds of candy, Airheads for 25 cents, Fun Dip for 40 cents, and Gummi Bears for 20 cents.

Write a program that will simulate this vending machine. First, accept coins from the user (user enters #of cents as integers 5, 10, or 25), until the user enters zero.

Then give the user a choice (with menu) for candies. If the user enters an invalid choice, display a "Invalid selection" message. If the amount deposited is sufficient, print the selection and calculate and display the change.

If the amount deposited is not sufficient, display a message for insufficient amount and return the money.

A sample input/output:

Insert coins: 10

Insert coins:10

Insert coins: 10

Insert coins: 0

Please select from the following menu: 1 - Airheads, 2 - Fun Dip, 3 - Gummi Bears

Enter your choice: 1

Candy dispensing

Your change is 5 cents

Reference no: EM132107335

Questions Cloud

How many different arrangements of the 10 huskies : Dogsled Ten huskies are to be selected to pull a dogsled. How many different arrangements of the 10 huskies on a dogsled are possible?
Determine the roots of a second order polynomial : Determine the roots of a second order polynomial. Prompt the user for the coefficients of the polynomial.
Which data outcome of the speed of cars : Which data outcome of the speed of cars would best support installing a speed bump?
Define random variables x and y as follows : Define random variables X and Y as follows: X(H) = 1, X(T) = 2, Y(H) = 2, Y(T)=1. Find CDF's of X and Y.Are X and Y equal in distribution? What is P(X=Y)?
Write a program that will simulate this vending machine : Write a program that will simulate this vending machine. First, accept coins from the user until the user enters zero.
Write a program for a virtual atm machine using java : You are to program a virtual ATM machine using Java. The client wants a GUI for its virtual ATM. The program will allow a user to enter their personal pin.
Create a class named cylinder with a field for the radius : Create a class named Cylinder with a field for the radius. Write code to display the surface area of both cylinders in an attractive fashion.
Write a program that will guess an integer : Write a program that will guess an integer that the user has picked. Imagine that the user will write down a positive integer x on a piece of paper.
A java program that first asks the user to enter integer : Using Eclipse, write a Java program that first asks the user to enter two integers seperately using JOptionPane.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a java application that displays the product number

Create a product class that holds the item number, the name of the product, the numberof units in stock, and the price of each unit.

  Generate a random number

A method called productsBuilder that takes no parameters and returns a String. In the method body construct a String

  Java format using netbeans ide

Having issues with the questions and getting it to work in a java format using NetBeans IDE - constructor that calls the parent's default constructor

  Wite a java application that allows the user to read

write a java application that allows the user to read validate store display sort and search the account

  Code the given java application

Using NetBeans, code the following Java application, and run it on Command prompt (Terminal If Linux) with the argument "notepad" (or "gedit" if Linux).

  The continual rise in popularity of php as a solution

Question: With the continual rise in popularity of PHP as a solution to e-commerce applications and the tendency to protect intellectual property, just how open do you think the future will be as far as Web application development is concerned? For t..

  How you will handle the pros and cons related to javascript

Assume that you were assigned a project at work that includes JavaScript, discuss how you will handle the Pros and Cons related to JavaScript.

  Prepare demo program that implements all of above method

Specify, design, and implement a class that can be used in a program that simulates a combination lock.

  Write down a detailed description of the problem

Using the simplified OOD methodology: Write down a detailed description of the problem. Identify all the (relevant) nouns and verbs

  Review of classes-objects-arrays and enhance for looping

Write Java code for class Produce that meets the listed requirements

  How do you create a class in java to enable its object

How do you create a class in Java to enable its object to be persistent and what are Java data streams and how are they used to facilitate storage and retrieval of persistent objects?

  Briefly explain how arrays could be used in the above app

A Chartered Financial Analyst wants a program that will produce a report to show her clients the benefits of saving for retirement

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