
strong textHello can someone help me with this problem,I need to output the following code using a loop the code is as follows with the user inputs in inverted commas,thanks.
ENTER CODE(XX to Stop) CODE:"D24" QUANTITY:"2" CODE:"K19" QUANTITY:"1" CODE:"XX"

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();
}
}
}`print("code sample");`

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();
}
}
}

import java.util.*;
import javax.swing.*;
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=JOptionPane.showInputDialog("Enter code: ");
System.out.print("\""+code+"\"");
System.out.println();
System.out.print("Quantity: ");
int quantity=Integer.parseInt(JOptionPane.showInputDialog("Enter quantity: "));
System.out.print("\""+quantity+"\"");
System.out.println();
while(!code.equals("XX")){
System.out.print("Code:" );
code=JOptionPane.showInputDialog("Enter code: ");
System.out.print("\""+code+"\"");
if(code.equals("XX")){
break;
}
System.out.println();
System.out.print("Quantity: ");
quantity=Integer.parseInt(JOptionPane.showInputDialog("Enter quantity: "));
System.out.print("\""+quantity+"\"");
System.out.println();
}
}
}
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.