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

  Java program to write-read data from user using i-o function

Write java program to write and read data from user using I/O functions. Describe class with data members name[20],emp_id,basic pay,net pay.calculate all the allowances.

  Implement an intrusion detection system in java

You are to implement an intrusion detection system in java. Calculate a threshold for detecting an intrusion. The threshold is 2*(Sums of weights).

  Prepare executable program and a dictionary program

Prepare executable program and a dictionary Program.

  Setting up the form page

Download and save the attached comment CGI mailer script form-mail2.pl to your server's cgi-bin directory, and change the permissions on the script to make it executable (not writable).

  Write various bindings to determine semantics

Write the various bindings that are required to determine the semantics when statement is executed. For each binding, indicate binding time used for language. Describe your answer.

  Java program to read line of text which ends with period

Write down the java program which will read the line of text which ends with the period, which serves as sentinel value. Show all the letters which occur in the text.

  How to access to elements of document object model

To limit creation of malicious code, do you believe that access to elements of document object model and some Javascript functionality be limited?

  Java program to find solution of cryptarithmetic puzzle

A solution to puzzle is S=9, R=8, O=0, M=1, Y=2, E=5, N=6, D=7. Write down a java program which finds solution to cryptarithmetic puzzle of: TOO + TOO + TOO + TOO = GOOD.

  Write a java program to perform matrix multiplication

In this project you need to write a java program called to perform matrix multiplication and

  Write java program to read present basic hourly wage

Write down a java program which will input 1. Read present basic hourly wage. Read in workers fist name and socond name.

  Describe principles of data abstraction and inheritance

Study the principles of data abstraction, inheritance and dynamic binding. Use Library to get started on finding resources.You must take the terms and describe it.

  Design java program to enter name in input dialog box

Design the program called MailingLabel.java Program must ask user to enter name and address in input dialog box with each component of address seperated by comma.

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