
Hello can you help me with this program,I am trying to add a loop at the end of the program but it is not compiling,thank you.
import java.util.*; import java.text.*; class HardwareItems { String code; String description; double price;
HardwareItems(String code,String description,double price){
this.code=code;
this.description=description;
this.price=price;
}
public String getCode(){
return code;
}
public String getDescription(){
return description;
}
public double getPrice(){
return price;
}
public static void main(String []args){
Scanner in=new Scanner(System.in);
double total=0;
ArrayList<HardwareItems> list=new ArrayList<HardwareItems>();
list.add(new HardwareItems("K16","Wood screws,brass,20mm",7.75));
list.add(new HardwareItems("D24","Wood glue,clear,1 liter",5.50));
list.add(new HardwareItems("M93","Sandpaper,fine grade",10.25));
list.add(new HardwareItems("M94","Sandpaper,fine grade",14.75));
DecimalFormat df=new DecimalFormat("$ ##.##");
System.out.println("Hardware Items");
System.out.println();
System.out.println("Code "+" Description "+" Unit Price ");
for(HardwareItems e : list){
System.out.println(e.getCode()+"\t"+e.getDescription()+"\t"+df.format(e.getPrice()));
}
System.out.println("place your order!");
System.out.print("NAME:");
String l=in.next();
System.out.print("ADDRESS-1:");
String m=in.next();
System.out.print("ADDRESS-2:");
String n=in.next();
System.out.print("ADDRESS-3:");
String o=in.next();
System.out.print("POST CODE:");
String p=in.next();
System.out.println("Enter Code (XX to stop)" ); System.out.print("Code:" ); String code=in.next(); System.out.print("Quantity: "); int quantity=in.nextInt(); while(!code.equals("XX")){ System.out.print("Code:" ); code=in.next(); if(code.equals("XX")){ break; } System.out.print("Quantity: "); quantity=in.nextInt(); } }

Which line you are getting compilation problems and what was the error ?
Chandraprakash Sarathe
http://javaved.blogspot.com/
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.