Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

Have Programming Question? Ask it here!
 
 
 


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


Advertisement
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.   
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   how and where, we can define methods ? can u explain me with full programme and using comments
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
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
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
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
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
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
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"><
How to provide navigation in quiz application using jsp?
How to provide navigation in quiz application using jsp?  hi everyone. i am using jsp with mysql connectivity. i have to retrieve questions from db one at a time. on clicking the next it should go the next question
provide code in servlets,javascript,jsp - JavaMail
provide code in servlets,javascript,jsp  i create mail like fallowing subject:TEXTFEILD Email:TEXTAREA FOOTER:TEXTFEILD >here some... radiobutton automatically. So frnds please understand my problem urgently provide
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
Please provide the java code for the given program.
Please provide the java code for the given program.   We need an application for managing an educational institute. That application should provide the details of Students Courses Faculty Fee details etc..,   
method inside the method??
method inside the method??  can't we declare a method inside a method in java?? for eg: public class One { public static void main(String[] args) { One obj=new One(); One.add(); private static void add
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
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
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
pls provide steps to write ejb3.0 simple application in eclipse - EJB
pls provide steps to write ejb3.0 simple application in eclipse   hi, pls provide steps to create simple ejb3.0 application in eclipse .And also how to create entity bean ,session bean in ejb3.0
get method
get method   how to use get method: secure method is post method and most of use post method why use a get method
method question
method question  How do I figure out the difference in a method heading, a method body, and a method definition
pls provide steps to connect mysql database in flex - XML
pls provide steps to connect mysql database in flex  hi,i am new to flex and doing project. i have doubt in how to connect MYSQL database in flex .pls provide the steps . i would be really thankful 2 u. i am loooking
pls provide common path to set image in flex - XML
pls provide common path to set image in flex  hi, pls provide common setpath to image in flex.when i give ful path like these C:\eclipse\workspace... like these ...\pictures\useful_links_logo.gif .its not working. pls provide
Method Overloading
Method Overloading  In java can method be overloaded in different class
Method Overloading
Method Overloading  In java can method be overloaded in different class
A method getColumnCount.
A method getColumnCount.  There is a method getColumnCount in the JDBC API. Is there a similar method to find the number of rows in a result set
Why does Java provide both abstract class as well as interface
Why does Java provide both abstract class as well as interface  why does java have both abstract class as well as interface? what is the need or importance of having both
How to compile PHP file and provide it to user without code?
How to compile PHP file and provide it to user without code?  I have created a class in PHP, that contains some useful methods. Now I want to give... in asp.net instead of providing code file. How can I compile the PHP file and provide
Please Provide the direct Downloadable source code for better understanding
Please Provide the direct Downloadable source code for better understanding  Hello Roseindia Team, This is Mohammed Vaseem. Am very much impressed.... I kindly request you to please provide the direct downloadable source code so
 

 

 

DMCA.com