adding a dialogue

Ads

 
 

Share on Google+Share on Google+

emrit latchman
adding a dialogue
1 Answer(s)      5 years and 9 months ago
Posted in : Java Beginners

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();
        }
    }
}
Ads
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
Version of com.nuecho>dialogue-runner dependency
List of Version of com.nuecho>dialogue-runner dependency
Advertisements
Version of com.nuecho>dialogue-runner dependency
List of Version of com.nuecho>dialogue-runner dependency
Adding an employee
Adding an employee  coding for adding an employee
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
Version of com.nuecho>rivr-voicexml-dialogue-runner dependency
List of Version of com.nuecho>rivr-voicexml-dialogue-runner dependency
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
Adding two numbers
Adding two numbers  Accepting value ffrom the keyboard and adding two numbers
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
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.3
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.3 in your project
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.4
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.4 in your project
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.5
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.5 in your project
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.6
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.6 in your project
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.7
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.7 in your project
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.8
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.8 in your project
Maven Dependency rivr-voicexml-dialogue-runner >> 1.0.9
You should include the dependency code given in this page to add Maven Dependency of com.nuecho >> rivr-voicexml-dialogue-runner version1.0.9 in your project
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
SaveAs Dialogue box is not working on button click in servlet
SaveAs Dialogue box is not working on button click in servlet  Hii Sir, i added response.setHeader into my servlet code to export the data into excel file but this is not working on button click ...plz give me
adding buttons - Swing AWT
adding buttons  can u plzz explain how to add button to a dialog box and make them perform some event on the image loaded on the panel
adding buttons - Swing AWT
adding buttons  can u plzz explain how to add button to a dialog box and make them perform some event on the image loaded on the panel
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
testcase for adding - JUNIT
testcase for adding  hi deepak...I am new to junit.can u send me a JUnit test case for adding or multiplying of two numbers.please i need it urgently
Adding Jar into Eclipse
Adding Jar into Eclipse  Hi, Please provide Step by step procedure to add jar, tld files and configurations in Eclipse Helios version and i am using Jboss5. Thanks&Regards, Shiva s
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

Ads

 
Advertisement null

Ads