Home Answers Viewqa Java-Beginners Provide a method that calculates the total of the order Provide a method that prints the Entree

 
 


soomei
Provide a method that calculates the total of the order Provide a method that prints the Entree
0 Answer(s)      7 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:
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
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
Please Provide jquery inline form validation
Please Provide jquery inline form validation  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd...;/head> <body> <form action="LabAccountServlet" method="post"><
Please provide jquery inline form validation for the code
Please provide jquery inline form validation for the code   <html> <head> <meta http-equiv="Content-Type" content="text/html...="white"> <form action="Student1Servlet" method="post" enctype="multipart/form
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
get and set method
a constructor that initialises the four instance variables. Provide a set and get method for each instance variable. In addition provide a method named getInvoiceAmount that calculates the invoice amount (i.e multiplies the quantity by the price
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
have any one tried ajaxanywhere with jsp/servlet please provide sample
have any one tried ajaxanywhere with jsp/servlet please provide sample  hello you can find this app here: http://ajaxanywhere.sourceforge.net... confused ) also in netbeans when i added this jar as said ,it shows me the method name
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
File.list() method
() method then it is working fine although s2 also prints as "d:/java" ?? help   Here is an example of File.lsit() method. The given code accepts the directory path in order to display the files and directories of that directory
how to code this?
Provide a method that calculates the total of the order Provide a method.... 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
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
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
how to code this?
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
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
java program on recursive method
(10 cents),and quarter(25 cents)? the coins must add up to the exact total, and you may assume that you have as many coins as necessary of each value. the order in which coins are selected is not significant; only the total number of coins
Pizza Order..?? - Java Beginners
Pizza Order..??  Define a class PizzaOrder class that contains a list... contains number of pizza been ordered. There is a method to add new pizza to the list (which increment the number of pizza been ordered) and also a method to calculate
please provide the code
please provide the code   Develop a multi-client chat application
Arrange a Column of Database Table
in ascending order with the help of some java method and APIs. See detailed...;    This section will provide you the facility for arranging the data of database table in ascending order. Firstly we should know
Please provide the code
Please provide the code   Write a program to recursively download the web pages available in the given site URL
Method in Java
Method in Java       In this section, we will explore the concept of method in the reference of object... in a class, object can't do anything without method. Some programming languages use
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
Use of delete() method in hibernate.
Use of delete() method in hibernate.  Define the use of delete() method of hibernate?   Hibernate provide the facility to delete one row... Department and the deptId. Now you can delete record by calling delete method
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.   
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
Regarding method returns multiple values
Regarding method returns multiple values  Hi, 1)I have a requirement like,1 method returns multiple values.how to do that one. 2)can i use method, for example like getFile()[] in this way or not. plzzzzzzzzzzzzzzzzzz provide
loadModule and unloadModule method in Flex 3
; provide methods loadModule() for load module and unloadModule() for unload...="Load / Unload method example" height="50%" width... main.swf and show result. Output:- 1. Output For loadModule() method:- 2
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
String substring method example
a string. String class provide methods for finding substring from string. Method... .style1 { font-size: medium; } String substring() method example... string. In this example we have used this method. Example:- <?xml
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
Use of getTotalIn and getTotalOut method of Inflater class in java.
getTotalIn() method returns total number of compressed bytes of input stream. The getTotalOut() method returns total number of Uncompressed bytes of output stream... returns total number of compressed bytes of input stream. The read() method
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
getAttribute() Method Of The Request Object
getAttribute() Method Of The Request Object... for the illustration of the getAttribute() method of the request object in JSP. This method retrieves the values corresponding to the given attribute name
Hibernate saveOrUpdate Method
Hibernate saveOrUpdate Method In this tutorial you will learn about the saveOrUpdate method in Hibernate. Hibernate's saveOrUpdate method inserts the new record and updates the modified value into the table. Using this method you can
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
Hibernate update Method
Hibernate update Method In this tutorial you will learn about the update method in Hibernate Hibernate's update method saves the modified value into the table after the modification made. Using this method you can update the modified
JavaScript floor method
JavaScript floor method       JavaScript floor method is used to achieve the next complete number in the downward position. For example if we apply the floor method
Java file get total space
of a disc or partition using the method getTotalSpace(). Output: Total...Java file get total space In this section, you will learn how to get the total... system. Then we have called the method getTotalSpace() of class File through
Hibernate persist Method
Hibernate persist Method In this tutorial you will learn about how to use persist method in hibernate. Hibernate's persist() method is used to insert / save the record to the database table. This method is equal to the save
JavaScript scrollIntoView() method
JavaScript scrollIntoView() method       This method scrollIntoView() is supported by both Internet Explorer and Firefox and can be a very useful method while applying scrolling
getParameter() Method Of The Request Object
getParameter() Method Of The Request Object... you about the getParameter() method of the request object. This section provides you the best illustration for why the method used or how to use in your JSP
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
JavaScript insertData method
JavaScript insertData method       JavaScript method insertData() can be used to insert some... for using the insertData() method is as follows :        

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.