Home Answers Viewqa Java-Beginners program an interface for a futuristic vending machine

 
 


soomei
program an interface for a futuristic vending machine
0 Answer(s)      8 months ago
Posted in : Java Beginners

program an interface for a futuristic vending machine that serves users hot food and drinks. Users enter input in from a numerical keypad that also contains a handful of letters. The customer will receive a menu and a prompts asking for their selection.

The vending machine needs to keep track of a few things: The customerâ��s order, which consists: 1) entree 2) drink It will need to calculate the orderâ��s total cost. After the entree and the drink is selected, the machine will repeat the order to the customer and display the total price. Step 1: Create a class to keep track of the customerâ��s order. Provide getters and setters for the entr�©e and drink. Provide a method that calculates the total of the order Provide a method that prints the Entree menu Provide a method that prints the Drink menu Provide a toString() method that returns a String in the following form: Your total for ENTEREE and DRINK is: ORDERCOST Example: Your total for salad and juice is: $2.50

Step 2: Main method & Scanner To allow users to enter input we will be using an instance of the Scanner class. The Scanner class is not a class available by default and must be imported with the import statement: import java.io.Scanner;

Step 2: Menu Prompt The first menu that is printed out for customer is the entree menu. Print this menu to the screen so customer can have a look at their choices. (Use your class method) Then following the menu, ask the customer what entree they would like to order and take in their input. Here is an example of the expected output: Entree Menu 1. Hamburger ($1.50) 2. Cheese Burger ($1.75) 3. Salad ($1.50) 4. Tacos ($1.00) 5. Hotdog ($1.00)

What entree would you like to order? 3 If they fail to enter a valid item prompt them again (use a loop) After the customer orders an entree, proceed to print out the drink menu and ask them which drink they would like to order. Here is an example of the expected output:

Drink Menu 1. Cola ($0.75) 2. Juice ($1.00) 3. Tea ($0.50) 4. Coffee ($0.50) 5. Water ($1.00)

What drink would you like to order? 2 If they fail to enter a valid item prompt them again (use a loop) After both items have been chosen, display the choices selected by the customer. The name of the items should be displayed rather than their numerical value. Ask for confirmation from the customer that this is the correct order. Ask the customer to enter ââ?¬Ë?yââ?¬â?¢ for yes and ââ?¬Ë?nââ?¬â?¢ for no. If the order is correct, display the total cost for the entree and drink. If the order in incorrect then print out to the screen, ââ?¬Å?Have a good day!ââ?¬Â? Sample Output Here's what I got when I ran my main method.

Entree Menu 1. Hamburger ($1.50) 2. Cheese Burger ($1.75) 3. Salad ($1.50) 4. Tacos ($1.00) 5. Hotdog ($1.00)

What entree would you like to order? 3

Drink Menu 1. Cola ($0.75) 2. Juice ($1.00) 3. Tea ($0.50) 4. Coffee ($0.50) 5. Water ($1.00)

What drink would you like to order? 2 Your current order is salad and juice. Is this correct (y/n)? y Your total for salad and juice is: $2.50 Have a good day! Here is an example of the final printout if I decided the order was wrong.

Your current order is salad and juice. Is this correct (y/n)? n Have a good day!

Step 3: Make the Vending machine continue until the users tell it to stop. After: ââ?¬Å?Have a Good Day!ââ?¬Â? Prompt the user to see if they wish to continue: Do you wish to order again (y/n)? If they enter ââ?¬Ë?yââ?¬â?¢ start over with the first menu. If they enter n exit the program.

View Answers









Related Pages:
Java Virtual Machine
Java: Java Virtual Machine After you read this section, you should be able... Machine. The Java Virtual Machine Most compilers translate from the source language (eg, C or Pascal) into machine language for one specific type
program to demonstrate java is machine nutral
program to demonstrate java is machine nutral   can any one give program to demonstrate java is machine nutral
Interface
Interface  Can Any one Give the exact program explanation for Interface in java? and want to know why they used interface instead of multiple inheritance? Thanks in advance   An interface is one which has abstract
Java Virtual Machine Technology
Java Virtual Machine Technology Java development kit termed as  JDK have.... This is the Virtual machine implementation comes with JDK.It is basically designed to cut... as server VM is specifically developed to enhancing program execution speed
Connect a linux machine from linux using java program without password
Connect a linux machine from linux using java program without password  Connect a linux machine from linux using java program without password. Can anyone help me
Java Virtual Machine Free Download
Java Virtual Machine Free Download       The Java Virtual Machine is required to run your java program in your computer. The Java Virtual Machine software is freely downloadable from
Java Virtual Machine
Java Virtual Machine The Java Virtual Machine is a software package that comes with the JRE or JDK. It is a virtual machine which is responsible for running.... The JVM is responsible for compiling the the byte code for the machine on which
program and Interface builder
program and Interface builder  Hi, I'm just getting started in iPhone development, If someone could please suggest a good criterion for when to use a nib to lay out UI elemennts and when to layout the UI elements
Java Virtual Machine Free Download
Machine is required to run your java program in your computer. The Java Virtual Machine software is freely downloadable from the sun website. To run your program we... Java Virtual Machine Free Download   
producer and concumer Interface program
producer and concumer Interface program  I need producer and concumer Interface program   Hi Friend, Try the following code: import java.util.*; class Multithreading { int val; boolean value = false; synchronized int
Java Virtual Machine
Java Virtual Machine       In this section, you will learn about the java virtual machine (JVM) and how to work? Java Virtual Machine (JVM) Java Virtual Machine is a set of computer
Discovery Machine Gear
Discovery Machine Gear       The Discovery Machine Modeler allows experts..., and leveraged. Discovery Machine Modeler our core knowledge acquisition
i want to copy files from one machine to other using java and the code will be running on third machine
i want to copy files from one machine to other using java and the code will be running on third machine  i want to copy some files from one machine say 'A' to some other machine say 'B' by using the java program running on third
Getting list of Local Interfaces on a machine
Getting list of Local Interfaces on a machine... to find out the total no of list of local interfaces available on a machine. Here... a NetworkInterface class of java.net package which represented the local interface. After
collection interface
collection interface  methods of collection interface and their description with example program?   Please visit the following links: http://www.roseindia.net/java/jdk6/Collection-Interfaces.shtml http
collection interface
collection interface  methods of collection interface and their description with example program?   Please visit the following links: http://www.roseindia.net/java/jdk6/Collection-Interfaces.shtml http
Set Interface
Set Interface       The Set interface extends the Collection interface.... It permits a single element to be null. The Set interface contains only methods
Java Remote Interface
Java Remote Interface       The Remote interface identifies interfaces whose methods may be invoked remotely from a non-local virtual machine. Any remote object must directly
Program
Program  Define Interface Insurance with methods: details()(name, types of services), no. of branches(), No. of customers(), annual_income(). Implement these methods in its Implementation class LIC, National, BajajAlliance
how to code this?
program an interface for a futuristic vending machine  program an interface for a futuristic vending machine that serves users hot food and drinks.... The vending machine needs to keep track of a few things: The customerââ?¬â
Overview of Networking through JAVA,Getting list of Local Interfaces on a machine
Getting list of Local Interfaces on a machine... to find out the total no of list of local interfaces available on a machine. Here... a NetworkInterface class of java.net package which represented the local interface. After
What is the List interface?
is list Interface in Java Program...What is the List interface?  Hi, What is the List interface? thanks,   The list interface is nothing but a subtype of tha java ordered
interface variables - Java Beginners
interface variables  why interface variables are final? explain me with good program example?? i knw why the variable is static but,i dont knw why it is final by default? thanks in advance
washing machine
washing machine   Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes   public class
Interface - Java Beginners
} implement the interface in a class called Grades. The program will read a series...Interface  Assignment: You are given the following interface: interface Stats { double getAverage(); //returns the average of scores
Interface in JSP
Interface in JSP          In interface none of its methods are implemented. All the methods are abstract. There is no code associated with an interface
collection overview and collection interface
collection overview and collection interface  write the program for collection interface?   Please visit the following links: http://www.roseindia.net/java/jdk6/Collection-Interfaces.shtml http://www.roseindia.net
interface
interface   what is the use of marking interface
interface - Java Beginners
interface  I need the complete program for Design of java interface for Stack ADT and implement the same using array and linked list in java. Kindly send it as soon as possible. SOme of your solutions are not accessible
Java Virtual Machine(JVM)
Java Virtual Machine(JVM)       Ques:-What is Java Virtual Machine? Ans:- Java Virtual Machine JVM is the main component of Java architecture and it is the part
interface.
interface.  Write short note on interface.   Please visit the following link: Java Interface
interface
interface  will the interface implements a interface   Hi Friend, No. Interface can extends another interface but cannot implements it, because interface will not contain the implementation. Thanks
Graphic interface java help
Graphic interface java help  A modified checkers program with class name Checkers using double buffering. Somehow the program must have two top.... Somehow need to enhance the Checkers program above to respond to mouse clicks
EJB remote interface
of the Program Accessing Remote Interface using EJB... EJB remote interface       The program given below describes  the way of creating a remote
EJB remote interface
EJB remote interface       The program given below describes  the way of creating a remote interface...;} } Output of the Program Accessing Remote Interface using
Interface - Java Beginners
Interface  Dear Sir, Could you send me a java program for INTERFACE? Thank You.  Hi Friend, Try the following code: import java.lang.*; import java.io.*; import java.util.*; interface MyInterface { int
INTERFACE
INTERFACE  how interface support multiple inheritance in java
interface
interface   Hi I have interface in that interface 3 methods are there , after some days client said that,i want to add one more method in that interface ,so how can add 4 method so that the implemented class did not affect
interface
interface  can we extend interface?   Hi Friend, Yes an interface can be extended by other interface like using extends keyword interface A{ } interface B extends A{ } For Example: interface IntefaceA { void
Interface in java with example
, that implements a empty method message(). How to create interface in java program: Following is the code of interface in java program. We have created interface...We are going to discuss about Interface in Java. Interface is blueprint
interface
interface  what the use of interface?   An interface is one... variables.Any class can implement(inherit)the interface and make use... is achieved by using the interface (by implementing more than one interface at a time
How to solve concurrency issue when an application is running on two machine to fetch record from one database
How to solve concurrency issue when an application is running on two machine... in java to run on two machines. Program will fetch a record from database and process it. I want to make sure that when application run on two machine
interface
interface  What is marker interface ?? what is its use in java programming?? is this us in programming ??Explain is implementation with code
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
Interface
Interface  I need to implement the interface without overriding its method and also don't use abstract class for this. How to do
Java Graphical user interface
of your Java quiz GUI application are specified by the following program flow... of the GUI in first stage. Your program window should be located at the centre of the screen when it starts. It provides an interface to register the student name
interface
interface  What is the exact use of interface in real time scenario? some people says that interface provides multiple inheritance. Is it true...; Through interface, we can achieve the multiple inheritance. Java does
Java-Generic Interface
" file by compiling c program using MF cobol. -Cobol application calls... and publish it to java program -Now we are getting request from other modules in our... replace C connector by java program which can receive xml messages and parse
Introduction to List and Queue Interface
Introduction to List and Queue Interface        List Interface : The List interface extends the Collection interface to define