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



Home Answers Viewqa Java-Beginners program not compiling
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


emrit latchman
program not compiling
1 Answer(s)      2 years and 11 months ago
Posted in : Java Beginners


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


Advertisement
View Answers

January 27, 2012 at 1:49 PM


Which line you are getting compilation problems and what was the error ?

Chandraprakash Sarathe
http://javaved.blogspot.com/



Related Tutorials/Questions & Answers:
program not compiling
program not compiling  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
process of compiling and running java program
process of compiling and running java program  Explain the process of compiling and running java program. Also Explain type casting
Advertisements
Compiling and Running Java program from command line
Compiling and Running Java program from command line - Video tutorial... of compiling and running java program from command line. We have also video... the process of compiling and running the Java program from command prompt
Compiling package in command line
Compiling package in command line  Hi friends, i am totally new... as an internal or external command, operable program or batch file. please help me how to compile it. Thanks & Regards, Sham   Compiling Java
compiling .class files
compiling .class files  how do i compile .class files using eclipse
Compiling Error - Java Beginners
Compiling Error  cant able to compile java servlet file in the command prompt? WHY? but i can compile normal java file give me answer to fix my problem
Compiling a Servlet - JSP-Servlet
Compiling a Servlet  Respected sir, I just want to know how to compile a servlet coding? I need it in a sequential way so that I can understand it at the very first time as I am new to this technology
Compiling Error - Java Beginners
Compiling Error  cant able to compile java servlet file in the command prompt? WHY? but i can compile normal java file give me answer to fix my problem.  Hi Friend, Do you have servlet-api.jar in the lib folder
error while compiling - Java Beginners
error while compiling  i am facing problem with compiling and running a simple java program, can any one help me, the error i am getting is javac is not recognised as internal or external command  Check if you JAVA_HOME
compiling programme IJVM
compiling programme IJVM  I TRY AND COMPILE THE PROGRAMME BELOW BUT HAS ERROR APPEAR ALL THE TIME,,CAN ANYONE CORRECT THE CODE AND WRITE UP THE NEXT METHOD FOR POWER IN THE PROGRAME AS WELL...URGENT // Program to read two single
Error While Compiling - Java Beginners
Error While Compiling  Hi All I Am a beginner and i face the following problem while compiling can anyone help me. C:\javatutorial\example>... command, operable program or batch file. C:\javatutorial\example>  
error in compiling j2me apllication - Applet
error in compiling j2me apllication  hi, in my j2me application for video,m getting only the audio.i ll send the code. package src.video_streaming; import javax.microedition.media.Manager; import
Compiling and Interpreting Applications in Java
following topics: Compiling Java Program Interpreting Java Program Compiling Java Program For compiling Java program, first your code must write... be the same as the class name. After this you can compile your program using javac
compiling a uploaed java file - JSP-Servlet
compiling a uploaed java file  How a uploaded java source file is automatically compiled(i.e converted to .class file) in server using jsp/servlet
Compiling Objective C
program on windows and Max OS x machine. Compiling Objective C program is necessary as it generates the executable program that can run. Compiling Objective C... Compiling Objective C     
i have got error while compiling simple tag handler
i have got error while compiling simple tag handler   javac.servlet.jsp not found! tell me what are the jar files required to run simple tag handler class   The package you have used javac.servlet.jsp does not exist
program
program  any program of hotel or school management
program
program  write a program different between to dates in terms of days in java
program
program  write a html program in show table and this word in box
program
program  write a javascript program to create a application form with validation
program
program  program of jdbc using ms access for creating table
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program
program  develop a servlet to insert the data in the database from our program in the table stored in the database
program
program  write a program reversee a string. input-hi this is roseindia output-roseindia is this hi
program
program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
program
program   An old-style movie theater has a simple profit program. Each customer pays $5 per ticket. Every performance costs the theater $20, plus $.50 per attendee. Develop the program calculateTotalProfit that consumes
program
program  write a java program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
program
program  Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder
program
program  explanation of program on extending thread class   Hi Friend, Please go through the following link: Java Threads Thanks
Program
Program  a program to create two classes Commercial and Domestic. Override the method calculatebill() of Commercial class(Rs.8 per unit) into Domestic class(Rs 6 per unit) to compute electricity bill for both classes
Advertisements
 

 

 

DMCA.com