The drink machine should have a supply

Assignment Help JAVA Programming
Reference no: EM13159269

Write an applet that simulates a soft drink vending machine. The simulated machine dispenses the following soft drinks: cola, lemon-lime soda, grape soda, root beer, and bottle water. These drinks cost $0.75 each to purchase.

When the applet starts, the drink machine should have a supply of 20 of each of the drinks. The applet should have a text field where the user can enter the amount of money he or she is giving the machine. The user can then click on a button to select a drink to dispense. The applet should also display the amount of change it is giving back to the user. The applet should keep track of its inventory of drinks and inform the user whether he or she has selected a drink that is out of stock. Be sure to handle operator errors such as selecting a drink with no money entered and selecting a drink with an inadequate amount of money entered.
To accomplish this, you need to create a class name Drink, use a constant for the price, and have properties to hold the inventory and the type of drink.

Make a button for each soda, each button should have a different color representing the soda, this color should also be a property of the class. When there is not enough money deposited or there are no more bottles of the selection, disable the button.

Reference no: EM13159269

Questions Cloud

Translate infix mathematical expression into postfix express : Write a program in java to translate infix mathematical expression into postfix expression and a program to evaluate the posfix expression. There should be three separate progams. use stack data abstraction and class implementation.
Concept of economic specialization : Explain the concept of economic specialization and the important reasons why a country would need to utilize this unique concept?
What are the main components of the broken windows theory : What are the main components of the broken windows theory? Explain. ?How do you think the broken windows theory served as an introduction to community-oriented policing? Explain. ?Do you think that this theory is still significant to community-orient..
Which of the following is not true of spermatogenesis : Which of the following is not true of spermatogenesis?
The drink machine should have a supply : When the applet starts, the drink machine should have a supply of 20 of each of the drinks. The applet should have a text field where the user can enter the amount of money he or she is giving the machine. The user can then click on a button to selec..
How do wheatley ideas support the new business realities : Describe Wheatley theories and perspectives of leadership and organization. How do Wheatley's ideas support the new business realities?
Which statement is not true about the menstrual cycle : Which statement is not true about the menstrual cycle?
What pressure will the air exert : A 200. mL air sample collected at 35°C has a pressure of 550. torr. What pressure will the air exert if it is allowed to expand to 425 mL at 48°C?
Construct and show a gross margin budget : Construct and show a gross margin budget for the activity. Construct and show a whole farm budget. Advise the farmer on the current and future profitability of the farm and possible options to improve performance.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write program in java to calculate interest

Write a program in java to do the following : the following data is stored for each customer in the bank: account number,average balance and number of transaction for each customer it is required to calculate the interest earn

  Java program which demonstrates cellular automata

Using the internet, locate a Java program (or Java applet) which demonstrates "Cellular Automata", in particular "the Game of Life".

  Java program for creating a order menu

Assume your consulting company has been hired to construct a program that meets the following requirements.

  Java applet to find how much federal tax we need to pay

Write a java applet to determine how much federal tax we need to pay assuming the tax rate is 12%.  Ask the taxable income.

  Write java program that writes names to text file

Create an empty text file called myfile.txt. Write a Java program that writes your names to the text file created. If the file does not exist, include an exception handler for that error.

  Write down java console application to add new student

Write down java console application presents the following menu. Add new student and scores in Biology, Physics and chemistry Search for a given student.

  Java project

Prompt the user for an int between lower and upper boundary.

  Create a java class called samearraysexception

Create a Java class called SameArraysException that extends the Exception class.

  Sequence of method in vector class

Construct a Vector class implementing a number of vector operations as methods along with a testing program to verify the class is working.

  Write program with jframe to enter series of names

Write a program with JFrame which permits user to enter series of friends' names and phone numbers and creates file from entered data.

  Write a class array that encapsulates an array

Write a class Array that encapsulates an array and provides bounds-checked access. The private instance variables should be int index and inarray[10]. The public members should be a default constructor and methods (signatures shown below) to provide ..

  Create a class safestack that implements a stack of strings

Create a class SafeStack that implements a stack of strings

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