adding a dialogue

Ads
 

adding a dialogue

Blockquote

Hi can you help with the program below,the program is a loop that prints out a code and a quantity when prompt for the user input.what I need is to modify the code to incorporate a dialogue asking whether another customer order is going to be placed so that it can processed an indefinite nunber of customers.Thank you!

import java.util.*;
class Output 
{
    public static void main(String[] args) 
    {
        Scanner input=new Scanner(System.in);
        System.out.println("Enter Code (XX to stop)" );
        System.out.print("Code:" );
        String code=input.next();
        System.out.print("Quantity: ");
        int quantity=input.nextInt();
        while(!code.equals("XX")){
        System.out.print("Code:" );
        code=input.next();
        if(code.equals("XX")){
            break;
        }
        System.out.print("Quantity: ");
        quantity=input.nextInt();
        }
    }
}
View Answers

February 1, 2012 at 12:30 PM

import java.util.*;
class Output { 
    public static void main(String[] args) { 
        Scanner input=new Scanner(System.in); 

        System.out.print("Code:" ); 
        String code=input.next(); 
        System.out.print("Quantity: ");
        int quantity=input.nextInt();
        String check="";
          while(!check.equals("no")){
        System.out.print("Is there another Customer order?(yes/No) :");
         check=input.next();
        if(check.equals("yes")){
         System.out.print("Code:" );
            code=input.next();
         System.out.print("Quantity: ");
            quantity=input.nextInt();
        }
        else{
            break;
            }
           }
        }
}

Ads









Related Tutorials/Questions & Answers:
adding a dialogue
adding a dialogue  Blockquote Hi can you help with the program below,the program is a loop that prints out a code and a quantity when prompt for the user input.what I need is to modify the code to incorporate a dialogue asking
ModuleNotFoundError: No module named 'dialogue'
ModuleNotFoundError: No module named 'dialogue'  Hi, My Python... 'dialogue' How to remove the ModuleNotFoundError: No module named 'dialogue... to install padas library. You can install dialogue python with following
Advertisements
Adding an employee
Adding an employee  coding for adding an employee
Version of com.nuecho>dialogue-runner dependency
List of Version of com.nuecho>dialogue-runner dependency
ModuleNotFoundError: No module named 'dialogue-opentok'
ModuleNotFoundError: No module named 'dialogue-opentok'  Hi, My... named 'dialogue-opentok' How to remove the ModuleNotFoundError: No module named 'dialogue-opentok' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'dialogue-tester'
ModuleNotFoundError: No module named 'dialogue-tester'  Hi, My... named 'dialogue-tester' How to remove the ModuleNotFoundError: No module named 'dialogue-tester' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'turberfield-dialogue'
ModuleNotFoundError: No module named 'turberfield-dialogue'  Hi...: No module named 'turberfield-dialogue' How to remove the ModuleNotFoundError: No module named 'turberfield-dialogue' error? Thanks   Hi
adding loop
adding loop  Hi I have a program that is not compiling when I add a loop can you help me?The program below is compiling without the loop. > Blockquote mport java.util.*; import java.text.*; import java.util.Scanner
ModuleNotFoundError: No module named 'multi-turn-dialogue'
ModuleNotFoundError: No module named 'multi-turn-dialogue'  Hi, My... named 'multi-turn-dialogue' How to remove the ModuleNotFoundError: No module named 'multi-turn-dialogue' error? Thanks   Hi
Adding two numbers
Adding two numbers  Accepting value ffrom the keyboard and adding two numbers
Maven Dependency dialogue-runner >> 0.9.0
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> dialogue-runner version0.9.0 in your project
Maven Dependency dialogue-runner >> 0.9.1
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> dialogue-runner version0.9.1 in your project
Maven Dependency dialogue-runner >> 0.9.2
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> dialogue-runner version0.9.2 in your project
Version of com.nuecho>rivr-voicexml-dialogue-runner dependency
List of Version of com.nuecho>rivr-voicexml-dialogue-runner dependency
javascript adding a value to an array
javascript adding a value to an array  How to add a value to a function argument or an array in JavaScript
adding view to viewcontroller
adding view to viewcontroller  How to add a frame window that opens on button click .. in iPhone application
adding groups in contacts
adding groups in contacts  how to add groups in contacts using servlet and jsp????pls help.thanku in advance
Adding photo to iPhone simulator
Adding photo to iPhone simulator  Hi, there is no photo in my iPhone simulator.. how can i add one? Please suggest. Thanks
Dynamically adding textbox and labels
Dynamically adding textbox and labels  Sir, In my application I want to insert texbox and labels dynamically and want to insert database field value in that generated label. Plz help me, Thanks in advance
webservices adding in eclipse
webservices adding in eclipse  hi team, i am working on webservices, please guide me how to add webservices in eclispe with step by step and give some examples also.   Please visit the following link: http
Adding images in itext pdf
Adding images in itext pdf  Hi, How to add image in pdf file using itext? Thanks   Hi, You can use following code: PdfWriter.getInstance(document,new FileOutputStream("imagesPDF.pdf")); Read more at Inserting
Java: Adding Row in JTable
Java: Adding Row in JTable   how about if we already have the JTAble created earlier. And i just found nothing to get its DefaultTableModel, thus, I can't call insertRow() method. Is there any work around for this? I found
jtable-adding a row dynamically
jtable-adding a row dynamically  hi..i am doing a project for pharmacy .. *pblm:* when i want to enter the details in jtable while running the application there are 3 rows and 4 columns which is default bt when we we have
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...(100,60,1300,600); add(pane); //Action Listener for button //for adding new
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...(100,60,1300,600); add(pane); //Action Listener for button //for adding new
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...(100,60,1300,600); add(pane); //Action Listener for button //for adding new
Dyanmically Adding Rows
Dyanmically Adding Rows  Hi sir Am doing project in that i need to add date picker in dynamically adding rows but the dates are storing in first test box only ill paste my code debug that code as soon as possible. Regards
adding the delete code
adding the delete code  hello sir... i need to add a delete button to my code but i didn't know where can i put it.. i've tried but still not working.. please help me...this is the code.. package newproject1; import java.awt.
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.0
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.0 in your project
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.1 in your project
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.2
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.2 in your project

Ads