Share on Google+Share on Google+

soomei
Provide a method that calculates the total of the order Provide a method that prints the Entree
0 Answer(s)      4 years and 6 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.

Ads

View Answers









Related Tutorials/Questions & Answers:
JDBC doesn't provide an EOF method.
JDBC doesn't provide an EOF method.  How can I know when I reach the last record in a table, since JDBC doesn't provide an EOF method
identify the order of growth of the average running time of the method.
identify the order of growth of the average running time of the method.   public static void manypeak (int n, double size) { if (n > 0) manypeak(n/2, size/2); for (int i = 1; i <=n; i++) { drawpeak(size); //method
Advertisements
identify the order of growth of the average running time of the method.
identify the order of growth of the average running time of the method.   public static void manypeak (int n, double size) { if (n > 0) manypeak(n/2, size/2); for (int i = 1; i <=n; i++) { drawpeak(size); //method
String fromCharCode() method example in Action Script3
.style1 { font-size: medium; } String fromCharCode() method example in Action Script3:- String provide a method to find characters by the character code using fromCharCode() method. we have define a string using this method
identify the order of the average running time of the method
identify the order of the average running time of the method  public static double getMedian (double[] A) { // given an ordered array of length n, return the median int n = A.length; if ((n % 2) == 1) return A[n/2]; else
please provide the code
please provide the code   Develop a multi-client chat application
Please provide the code
Please provide the code   Write a program to recursively download the web pages available in the given site URL
Please provide the code
Please provide the code   Program to find depth of the file in a directory and list all files those are having more number of parent directories
Provide the code please
Provide the code please   Program to calculate the sum of two big numbers (the numbers can contain more than 1000 digits). Don't use any library classes or methods (BigInteger etc
Please provide the code
Please provide the code   Create a file system: We just have one file on the hard disk. But we can create directories, sub-directories and files in that file only
Please provide the coding for this problem
Please provide the coding for this problem  Please provide the coding for the following problem. Write a "hangman" game that randomly generates a word and prompts the user to guess one letter at a time. Each letter in the word
provide source - Java Beginners
provide source  please provide code for this program Write a program to download a website from a given URL. It must download all the pages from that website. It should take the depth of retrieval from the user input. All
provide me the program for that ques.
provide me the program for that ques.  wtite a program in java there is a class readchar.the functionality of this class is to read a string from the console and display the characters of that string on the console.   
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
provide code - Swing AWT
provide code  Dear frnds please provide code for two player CHESS GAME.....using swings,awt concepts   Hi friend, import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public
method
method  can you tell me how to write an abstract method called ucapan() for B2 class class A2{ void hello(){ system.out.println("hello from A2"); }} class B2 extends A2{ void hello(){ system.out.println("hello from B2
please provide code - Java Beginners
please provide code  provide code to snake game in J2SE
provide me code - Java Beginners
provide me code  can any body provide code for SNAKE XENZIA game in NOKIA mobile? please urgently
Please provide coding for following problem
Please provide coding for following problem  Please provide the coding for the following problem: You will write a java program that will read data... will be the initials followed by their score in sorted order from top score to lowest
provide example in J2ee/jsp - JSP-Servlet
provide example in J2ee/jsp  how to manage search options page in jsp using back end as oracle/sql? i am using multiple search options. so please provide code for this or tutorial
To provide Help Option - Java Beginners
To provide Help Option  hi i am writing one small application there i wanted to provide "Help" button to user.From there they will be geting how... theire own help article writen..." how we can provide our Help writen for our
Please provide option for full materials download...
Please provide option for full materials download...   Please provide option for full materials download ... i dont have internet connection in my home. plz provide offline tutorial option
how the streams provide synchronization - Java Beginners
how the streams provide synchronization  How the java streams provides synchronization
Plz Provide correct program code for all questions.
Plz Provide correct program code for all questions.   Write a program... of attendees (of a show) and calculates how much income the show earns. Develop... of a year. Total interest is the product of the principal, the annual interest
Can you provide me Hibernate configuration tutorial?
Can you provide me Hibernate configuration tutorial?  Hello There, I want to learn about Hibernate configuration, Can anyone provide me with hibernate configuration tutorial> Thanks
How to build .XML file, please provide an example.
How to build .XML file, please provide an example.  Hello, I want to know how to build .XML file. If you can provide an example, that would be great... Thanks
Plz provide me all the material for Java
Plz provide me all the material for Java  Plz provide me all the material for Java   Please go through the following link: Java Tutorials
Method
Method       In this section, we will explore the concept of method in the reference of object oriented... and behaviors are defined by methods. Method : An brief introduction Methods
How to provide timeout condition in my project
How to provide timeout condition in my project  Hi I am doing online examination system project i want 2 set time for my exam after that system shuld declare timeout how to provide that plz
Create a Program that Calculates Input
Create a Program that Calculates Input   Create a program that takes user input and does a calculation with it, then prints the results back.... For top points, provide options and make the program pretty. (ASCII art &
pls provide steps to connect mysql in flex - XML
pls provide steps to connect mysql in flex   hi ,PLS SUGGEST ME I HAVE NO IDEA WHERE TO PLACE THE FUNCTIONS.PHP CODE.I HAVE WAMP SERVER .CAN I PASTE... PROVIDE THE SET PATH.PLS IAM LOOKING FOR UR REPLY.THANKS INADVANCE
Tutorials   
Java Spring Hibernate Struts Training Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized

Ads

 
Advertisement null

Ads